open-index/open-npm huggingface dataset:
npm package: @fiber-pay/agent
Description: AI agent orchestration layer for Fiber Network with MCP tools
Latest version: 0.2.1

# @fiber-pay/agent

AI-agent orchestration layer for Fiber Network (targeting Fiber `v0.8.0`).

This package provides:

- `FiberPay`: high-level, agent-friendly API on top of `@fiber-pay/sdk` + `@fiber-pay/node`
- `MCP_TOOLS`: MCP tool schema definitions for model/tool integration

## What this package is (and is not)

`@fiber-pay/agent` is an orchestration layer, not a separate protocol implementation.
It composes existing SDK and node lifecycle capabilities into one API designed for autonomous agents.

It currently exports MCP tool **definitions/schemas**; host-side tool execution wiring is still your responsibility.

## Install

```bash
pnpm add @fiber-pay/agent
```

## Quick start

```ts
import { createFiberPay } from '@fiber-pay/agent';

const fiber = createFiberPay({
  dataDir: `${process.env.HOME}/.fiber-pay`,
  network: 'testnet',
});

const init = await fiber.initialize();
if (!init.success) throw new Error(init.error?.message ?? 'init failed');

const balance = await fiber.getBalance();
console.log(balance.data);

await fiber.shutdown();
```

## Runtime job orchestration

By default, `FiberPay` enables runtime-backed job orchestration for:

- `pay()`
- `createInvoice()`
- `createHoldInvoice()`
- `settleInvoice()`
- `openChannel()`
- `closeChannel()`

This uses an internal SQLite job store and waits for terminal job states before returning.

Config knobs:

- `useRuntimeJobs` (default: `true`)
- `runtimeJobsDbPath` (default: `${dataDir}/runtime-jobs.db`)

Disable orchestration to force direct RPC calls:

```ts
const fiber = createFiberPay({
  dataDir: `${process.env.HOME}/.fiber-pay`,
  useRuntimeJobs: false,
});
```

## API surface summary

### Lifecycle

- `initialize()`
- `shutdown()`

### Payments and invoices

- `pay()`
- `createInvoice()`
- `getPaymentStatus()`
- `getInvoiceStatus()`
- `createHoldInvoice()`
- `settleInvoice()`
- `waitForPayment()`

### Channels and node state

- `listChannels()`
- `openChannel()`
- `closeChannel()`
- `waitForChannelReady()`
- `getNodeInfo()`
- `getBalance()`

### Safety, verification, and observability

- `validateInvoice()`
- `analyzeLiquidity()`
- `canSend()`
- `getPaymentProof()`
- `getPaymentProofSummary()`
- `getPaymentAuditReport()`
- `getSpendingAllowance()`
- `getAuditLog()`

All async operations return `AgentResult<T>`:

```ts
type AgentResult<T> = {
  success: boolean;
  data?: T;
  error?: {
    code: string;
    message: string;
    recoverable: boolean;
    suggestion?: string;
  };
  metadata?: {
    timestamp: number;
  };
};
```

## MCP integration

```ts
import { MCP_TOOLS } from '@fiber-pay/agent/mcp';

for (const tool of Object.values(MCP_TOOLS)) {
  // register with your MCP host runtime
  // mcpServer.registerTool(tool)
}
```

See `src/mcp-tools.ts` for complete tool names and JSON schemas.

## Compatibility

- Node.js: `>=20`
- Fiber RPC semantics: aligned with Fiber `v0.8.0`

## Known gaps

- No dedicated `@fiber-pay/agent` test suite yet
- MCP runtime execution adapter is not bundled in this package
npm package: @fiber-pay/cli
Description: Command-line tool for managing Fiber Network nodes
Latest version: 0.2.1

# @fiber-pay/cli

Command-line tool for managing Fiber Network nodes.

## Install

```bash
pnpm add @fiber-pay/cli
```

## Usage

```bash
fiber-pay --help
fiber-pay node start --json
fiber-pay l402 proxy --target http://localhost:3000 --price 0.1
fiber-pay agent serve --agent codex --price 0.1
fiber-pay agent call http://host:8402 --prompt "your question"
```

See [docs/l402-agent-guide.md](../../docs/l402-agent-guide.md) for L402 and agent details.

## Compatibility

- Node.js `>=20`
- Fiber target: `v0.8.0`
npm package: @fiber-pay/node
Description: Fiber Network node binary management and process lifecycle
Latest version: 0.2.1

# @fiber-pay/node

Fiber node binary management and process lifecycle utilities.

## Install

```bash
pnpm add @fiber-pay/node
```

## Usage

```ts
import { createFiberNodeManager } from '@fiber-pay/node';
```

## Compatibility

- Node.js `>=20`
- Fiber target: `v0.8.0`
npm package: @fiber-pay/sdk
Description: Core SDK for building Fiber Network applications on CKB Lightning
Latest version: 0.2.1

# @fiber-pay/sdk

Core SDK for building Fiber Network applications on CKB Lightning.

## Install

```bash
pnpm add @fiber-pay/sdk
```

## Entrypoints

- `@fiber-pay/sdk` - Universal APIs (browser-safe)
- `@fiber-pay/sdk/browser` - Browser WASM node and browser credential providers
- `@fiber-pay/sdk/node` - Node-focused APIs, including L402 middleware utilities

## Usage

```ts
import { FiberRpcClient } from '@fiber-pay/sdk';

const client = new FiberRpcClient({
  url: 'http://127.0.0.1:8227',
  biscuitToken: process.env.FIBER_RPC_BISCUIT_TOKEN,
});

const info = await client.nodeInfo();
console.log(info.pubkey);
```

## Browser Usage

Use the browser subpath in frontend apps to avoid pulling Node-only modules:

```ts
import { BrowserRpcClient } from '@fiber-pay/sdk/browser';

const client = new BrowserRpcClient({
  url: 'http://127.0.0.1:8227',
});

const info = await client.nodeInfo();
console.log(info.pubkey);
```

`@fiber-pay/sdk/browser` also exports `FiberRpcClient` for migration compatibility.

## RPC Authentication (Biscuit)

- Pass `biscuitToken` to `new FiberRpcClient(...)`.
- SDK sends `Authorization: Bearer <token>` on every JSON-RPC request.
- Keep tokens on trusted backend/server side; avoid embedding privileged tokens in browser bundles.

Generate token-side permission facts from RPC methods:

```ts
import { renderBiscuitFactsForMethods } from '@fiber-pay/sdk';

const facts = renderBiscuitFactsForMethods([
  'list_peers',
  'send_payment',
  'get_payment',
]);

console.log(facts);
// read("payments");
// read("peers");
// write("payments");
```

This helper aligns with upstream Fiber Biscuit permission mapping (method -> read/write resource),
and can be used to prepare `permissions.bc` inputs before signing tokens.

## L402 Protocol

Use the Node entrypoint for L402 payment-gating primitives:

```ts
import {
  createL402Middleware,
  FiberRpcClient,
  MacaroonService,
} from '@fiber-pay/sdk/node';
```

Node entry includes the same universal APIs as root, plus L402 server helpers.

L402 primitives include:

- `MacaroonService` — mint and verify L402 tokens
- `createL402Middleware()` — Express middleware for 402 challenge-response flow

See [docs/l402-agent-guide.md](../../docs/l402-agent-guide.md) for usage.

## Compatibility

- Node.js `>=20`
- Fiber target: `v0.8.0`
npm package: @fiberplane/cli
Description: CLI tool for Fiberplane services
Author: Fiberplane
Latest version: 0.2.1

# Fiberplane CLI

A TypeScript-based CLI tool for Fiberplane services.

## Commands

### Deploy

Deploy your application to Fiberplane:

```bash
fiberplane-cli deploy [directory]
```

The deploy command automatically:
1. **Project Management**: Checks for an existing project ID in `.fiberplane` file, or creates a new project if none exists
2. **File Scanning**: Scans the target directory for deployment files
3. **Upload**: Uploads files to Fiberplane services for deployment

### Authentication

```bash
fiberplane-cli auth login    # Login to Fiberplane
fiberplane-cli auth logout   # Logout from Fiberplane
fiberplane-cli auth status   # Check authentication status
```

## Project Management

The CLI automatically manages project associations through a `.fiberplane` file in your project directory. This file contains:

```json
{
  "projectId": "project-nanoid-here",
  "createdAt": "2024-01-01T00:00:00.000Z"
}
```

**Important**: Add `.fiberplane` to your `.gitignore` if you don't want to commit project IDs to version control.

## Installation

```bash
pnpm install
pnpm build
```

## Development

```bash
# Watch mode for development
pnpm dev

# Build for production
pnpm build

# Run the CLI locally
pnpm start

# Or run directly with node
bin/cli
```

## Project Structure

```
internal/cli/
├── bin/
│   └── cli             # Executable entry point
├── src/
│   └── index.ts        # Main CLI logic
├── dist/               # Compiled output (generated)
├── package.json        # Package configuration
├── tsconfig.json       # TypeScript configuration
└── README.md           # This file
```
npm package: @fiberplane/mcp-server-fiberplane
Description: MCP server for Fiberplane Studio
Author: Fiberplane
Latest version: 0.3.0

# Fiberplane Model Context Protocol Server

This is a proof of concept model context protocol server for querying Fiberplane Studio local API using the Model Context Protocol.

## Setting up using Claude Desktop

If you have Claude Desktop installed, update the configuration to use the local MCP server.

```json
{
  "mcpServers": {
    "fiberplane": {
      "command": "npx",
      "args": [
        "@fiberplane/mcp-server-fiberplane"
      ]
    }
  }
}
```

> **Note**
> If you're using NVM or FNM or any other Node version manager, Claude Desktop will not be able to find the `node` command. Use the following snippet as reference. Issue tracked [here](https://github.com/modelcontextprotocol/servers/issues/64)
>
> ```json
> {
>   "mcpServers": {
>     "fiberplane": {
>       "command": "<path_to_node>",
>       "args": [
>         "<path_to_globally_installed_npm_packages_>/@fiberplane/mcp-server-fiberplane/dist/index.js"
>       ]
>     }
>   }
> }
> ```
npm package: @fiberplane/spectacular-cli
Description: An interactive CLI to iterate on project specifications with AI
Author: Fiberplane
Latest version: 0.0.13

# spectacular-cli

A CLI that helps you generate spectacular specs.

## Usage

```bash
npx @fiberplane/spectacular-cli@latest
```

## Development

### Important Files for LLM Calls

- `src/commands` - Code for the different cli commands (e.g. `init`, `create-schema`, `apikey:list`, etc.)
- `src/actions` - Code that implements CLI logic
  - `src/actions/ideate.ts` - Logic for the back-and-forth between user and assistant before generating the spec
- `src/integrations/` - Code for integrations with LLM calls
  - `src/integrations/ideation-agent` - LLM calls for the spec generation
  - `src/integrations/schema-agent` - LLM calls for the Drizzle database schema generation

### Evals

We're using [Evalite](https://evalite.dev/) to evaluate the CLI.

- `evals/` - Directory with eval code
- `evals/scorers/asked-one-question/` - Code that implements an LLM-as-a-judge scorer to verify that messages from the assistant go one-by-one when interacting with the end user.

### Local Development

To test individual commands, you can run them directly with the dev scripts:

- `npm run dev`
- `npm run dev:create-schema`
- `npm run dev:create-api`
- `npm run dev:apikey:add`
- `npm run dev:apikey:list`
- `npm run dev:apikey:remove`
npm package: @fibery/n8n-nodes-fibery
Description: n8n node for Fibery
Author: Misha Yermolayev
Latest version: 0.1.19

# n8n-nodes-fibery

![Fibery x n8n](./fibery-x-n8n.png)

This is an n8n community node. It lets you use Fibery in your n8n workflows.

Fibery is your company’s operating system
It's a work platform that replaces scattered tools and connects teams. Chosen by nerds, appreciated by everyone (almost).

[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.

[Installation](#installation)
[Operations](#operations)
[Credentials](#credentials)
[Compatibility](#compatibility)
[Usage](#usage)
[Resources](#resources)
[Version history](#version-history)

## Installation

Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.

1. Go to **Settings** > **Community Nodes**.
2. Select **Install**.
3. Enter `@fibery/n8n-nodes-fibery` in **npm Package name**.
4. Agree to the [risks](https://docs.n8n.io/integrations/community-nodes/risks/) of using community nodes: select **I understand the risks of installing unverified code from a public source**.
5. Select **Install**.

## Operations

### Database

- **get many**. List all databases in the workspace.

### Entity

- **create**. Create a new entity.
- **delete**. Delete an entity.
- **get**. Get an entity.s
- **get many**. Search and list entities from a database.
- **update**. Update an entity.

### Triggers

- **default**. Handle Fibery events to Database from webhooks.

## Credentials

At the moment this node supports only one authentication method: **API Key**.

### Using API Key

1. Enter the name of your Fibery workspace in the **Workspace** field. It can be obtained from the URL of your workspace. For example, if your workspace URL is `https://my-company.fibery.io`, then the workspace name is `my-company`.
2. Obtain an API key from your Fibery workspace. Please follow the [Fibery API keys](https://the.fibery.io/@public/User_Guide/Guide/Fibery-API-keys-252) guide.
3. Enter API key in the **API Key** field.

## Compatibility

Tested on: 1.111.0

## Resources

- [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
- [Fibery](https://www.fibery.io/)
- [Fibery API documentation](https://the.fibery.io/@public/User_Guide/Guide/Fibery-API-overview-279)
npm package: @fibery/notifications-stream
Description: A small utility to handle streaming requests.   It's one of our NPM packages. It is a wrapper around oboe.js to handle stream responses from services.   Used in TP Proxy and Hogwarts (and maybe somewhere else).
Latest version: 1.1.1

# Notifications Stream

A small utility to handle streaming requests.  
It's one of our NPM packages. It is a wrapper around oboe.js to handle stream responses from services.  
Used in TP Proxy and Hogwarts (and maybe somewhere else).
npm package: @fibery/stylelint-forbids-variables-with-name
Description: Stylelint rule forbids the use of variables with a specific name
Author: Konstantin Krivlenia
Latest version: 1.0.1

# forbids-variables-with-name

Stylelint rule forbids the use of variables with a specific name.

## Usage

Add it to your stylelint config `plugins` array, then add `"@vizydrop/stylelint-forbids-variables-with-name"` to your rules,
specifying the variables which you want to check.

Like so:

```js
// .stylelintrc
{
  "plugins": [
    "@vizydrop/stylelint-forbids-variables-with-name"
  ],
  "rules": {
    // ...
    "vizydrop/stylelint-forbids-variables-with-name": {
        forbiddenNames: [`@exactForbiddenTextColor`, `/@regEpx.+Color/`],
        ignoreNames: ['@exactForbiddenColor', '/^@regEpx.+Color$/'],
    }
    // ...
  }
}
```
npm package: @fibery/vizydrop-logger
Description: Vizydrop predefined logger based on winston v3
Author: Vizydrop Team
Latest version: 3.4.1

# logger

## Usage

```javascript
const logger = require(`@vizydrop/logger`);

const log = logger({
    level: `info`,
    mode: process.env.NODE_ENV,
    correlationId: {
        enabled: true,
        fieldName: `correlationId`, // default name is correlationId
        getCorrelationId: () => `correlation-id-value`, // required
        emptyValue: null, // used when correlation id is missing
    },
    additionalFields: {field1: `value`},
});

log.info(`message`);
```
npm package: @fibiorg/jsontypegen
Description: Json type generator for Typescript
Author: Filip Biterski
Latest version: 1.0.2

# @fibiorg/jsontypegen

`@fibiorg/jsontypegen` generates a Typescript type from a provided JSON input.

Check the [Demo](https://filibit.dev/jsontypegen).

## Install

`npm install @fibiorg/jsontypegen`

## Usage

```js
import { jsonToTypescript } from "@fibiorg/jsontypegen";

console.log(
    jsonToTypescript([
        { name: "Scarlet", age: 26, education: "university", friends: 3 },
        { name: "John", age: 30, friends: ["Anna", "Jackie"] },
    ])
    // Array<{"name":string;"age":number;"education"?:string;"friends":number|Array<string>;}>
);
```

### Format with prettier

`npm install prettier`

#### In node:

```js
import { format } from "prettier";

console.log(
    format(
        `Array<{"name":string;"age":number;"education"?:string;"friends":number|Array<string>;}>`,
        {
            parser: "typescript",
            tabWidth: 4,
            printWidth: 80,
        }
    )
);
```

### In browser

In a browser environment, Prettier doesn't come with necessary plugins so we need to provide ones.

```js
import * as prettier from "prettier";
import typescriptParser from "prettier/plugins/typescript";
import estreeParser from "prettier/plugins/estree";

format(
    `Array<{"name":string;"age":number;"education"?:string;"friends":number|Array<string>;}>`,
    {
        parser: "typescript",
        plugins: [typescriptParser, estreeParser],
        tabWidth: 4,
        printWidth: 80,
    }
);
```
npm package: @fibjs/builtin-modules
Description: builtin-modules of fibjs
Author: richardo2016@gmail.com
Latest version: 0.1.1

# @fibjs/builtin-modules

[![Build Status](https://travis-ci.org/fibjs-modules/builtin-modules.svg)](https://travis-ci.org/fibjs-modules/builtin-modules)
[![NPM version](https://img.shields.io/npm/v/@fibjs/builtin-modules.svg)](https://www.npmjs.org/package/@fibjs/builtin-modules)

> List of the [FibJS] builtin modules

## Pre-requisite

- `fibjs >= 0.21.0`

## Usage

```javascript
const builtinModules = require('@fibjs/builtin-modules');

console.log(builtinModules);
//=> ['assert', 'buffer', ...]
```

## API

Returns an array of builtin modules fetched from the running [FibJS] version.

## License

[MIT](https://opensource.org/licenses/MIT)

Copyright (c) 2018-present, Richard

[FibJS]:https://github.com/fibjs/fibjs
npm package: @fibjs/chalk
Description: chalk running on fibjs
Author: richardo2016@gmail.com
Latest version: 1.0.0

# @fibjs/chalk

[![Build Status](https://travis-ci.org/fibjs-modules/chalk.svg)](https://travis-ci.org/fibjs-modules/chalk)
[![NPM version](https://img.shields.io/npm/v/@fibjs/chalk.svg)](https://www.npmjs.org/package/@fibjs/chalk)

> chalk running on fibjs

## Pre-requisite

- `fibjs >= 0.21.0`

## Backend

- `chalk@^v2.4.2`

## Documents

See [chalk] v2.4.2

## License

[MIT](https://opensource.org/licenses/MIT)

Copyright (c) 2018-present, Richard

[FibJS]:https://github.com/fibjs/fibjs
[chalk]:https://github.com/chalk/chalk/tree/v2.4.2
npm package: @fibjs/ci
Description: CI tool for fibjs project.
Latest version: 2.7.2

# @fibjs/ci

Auto gen ci config file.

## Installation

```bash
$ npm i @fibjs/ci --save-dev
```

## Usage

Add `ci` property to your `package.json`:

```json
"ci": {
  // default ci env type is 'actions'
  "type": "actions",
  // default version is 0.33.0.
  "version": "0.33.0"
}
```

you can check available versions here: [fibjs.org/downloads/](fibjs.org/downloads/)

and ci system will automatically exec `npm run ci` command, so please add this to your `package.json`:

```json
"scritps": {
  "ci": "fibjs test/test.js"
}
```

## How

Use `npm postinstall` hoook to create the `*.yml` after each `npm install` run.

## License

[MIT](LICENSE)
npm package: @fibjs/cluster-server
Description: Start a multi-thread server to take advantage of multi-core systems.
Author: ngot
Latest version: 3.0.0

# @fibjs/cluster-server

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![appveyor build status][appveyor-image]][appveyor-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/@fibjs/cluster-server.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@fibjs/cluster-server
[travis-image]: https://img.shields.io/travis/fibjs-modules/cluster-server.svg?style=flat-square
[travis-url]: https://travis-ci.org/fibjs-modules/cluster-server
[appveyor-image]: https://ci.appveyor.com/api/projects/status/50xpe6gjlnlqnaxj/branch/master?svg=true
[appveyor-url]: https://ci.appveyor.com/project/ngot/cluster-server
[codecov-image]: https://img.shields.io/codecov/c/github/fibjs-modules/cluster-server.svg?style=flat-square
[codecov-url]: https://codecov.io/github/fibjs-modules/cluster-server?branch=master
[david-image]: https://img.shields.io/david/fibjs-modules/cluster-server.svg?style=flat-square
[david-url]: https://david-dm.org/fibjs-modules/cluster-server
[snyk-image]: https://snyk.io/test/npm/@fibjs/cluster-server/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/@fibjs/cluster-server
[download-image]: https://img.shields.io/npm/dm/@fibjs/cluster-server.svg?style=flat-square
[download-url]: https://npmjs.org/package/@fibjs/cluster-server

Start a multi-thread server to take advantage of multi-core systems.

## Install

```bash
$ npm i @fibjs/cluster-server --save
```

## Usage

server.js :

```js
const Cluster = require('@fibjs/cluster-server');
const path = require('path');

const server = new Cluster({
  port: 8000,// server port,default to 8000
  worker: path.join(__dirname, 'worker.js'), // full path to worker 
  numbers: 4,// default to cpu numbers
});

server.run(); // start server asynchronously
// server.close(); // close server
```

worker.js :

```js
module.exports = req => {
  req.response.write('Hello, World!');
};
```

then you can start server:

```bash
  fibjs server.js
```

## worker.js

We can export any handler described at [http://fibjs.org/docs/manual/module/ifs/mq.md.html#Handler](http://fibjs.org/docs/manual/module/ifs/mq.md.html#Handler).

## Questions & Suggestions

Please open an issue [here](https://github.com/fibjs-modules/cluster-server/issues).

## License

[MIT](LICENSE)
npm package: @fibjs/compose
Description: Compose middleware.
Author: ngot
Latest version: 1.0.0

# @fibjs/compose

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![appveyor build status][appveyor-image]][appveyor-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/@fibjs/compose.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@fibjs/compose
[travis-image]: https://img.shields.io/travis/fibjs-modules/compose.svg?style=flat-square
[travis-url]: https://travis-ci.org/fibjs-modules/compose
[appveyor-image]: https://ci.appveyor.com/api/projects/status/hnsvto46bnirhx1v/branch/master?svg=true
[appveyor-url]: https://ci.appveyor.com/project/ngot/compose
[codecov-image]: https://ci.appveyor.com/api/projects/status/kxw62502q9uo6aei?svg=true
[codecov-url]: https://codecov.io/github/fibjs-modules/compose?branch=master
[david-image]: https://img.shields.io/david/fibjs-modules/compose.svg?style=flat-square
[david-url]: https://david-dm.org/fibjs-modules/compose
[snyk-image]: https://snyk.io/test/npm/@fibjs/compose/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/@fibjs/compose
[download-image]: https://img.shields.io/npm/dm/@fibjs/compose.svg?style=flat-square
[download-url]: https://npmjs.org/package/@fibjs/compose

Compose middleware.

## Install

```bash
$ npm i @fibjs/compose --save
```

## Usage

```js
const compose = require('@fibjs/compose');

const middleware = [
  (ctx, next) => {
    next();
  },
  (ctx, next) => {
    next();
  },
];

const fn = compose(middleware);
const ctx = {
  num: 1,
};

fn(ctx)(ctx, (ctx) => {});

```

## Questions & Suggestions

Please open an issue [here](https://github.com/fibjs-modules/compose/issues).

## License

[MIT](LICENSE)
npm package: @fibjs/copy
Description: copy file or directory recursively asynchronously.
Author: ngot
Latest version: 1.1.1

# @fibjs/copy

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![appveyor build status][appveyor-image]][appveyor-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/@fibjs/copy.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@fibjs/copy
[travis-image]: https://img.shields.io/travis/fibjs-modules/copy.svg?style=flat-square
[travis-url]: https://travis-ci.org/fibjs-modules/copy
[appveyor-image]: https://ci.appveyor.com/api/projects/status/hnsvto46bnirhx1v/branch/master?svg=true
[appveyor-url]: https://ci.appveyor.com/project/ngot/copy
[codecov-image]: https://img.shields.io/codecov/c/github/fibjs-modules/copy.svg?style=flat-square
[codecov-url]: https://codecov.io/github/fibjs-modules/copy?branch=master
[david-image]: https://img.shields.io/david/fibjs-modules/copy.svg?style=flat-square
[david-url]: https://david-dm.org/fibjs-modules/copy
[snyk-image]: https://snyk.io/test/npm/@fibjs/copy/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/@fibjs/copy
[download-image]: https://img.shields.io/npm/dm/@fibjs/copy.svg?style=flat-square
[download-url]: https://npmjs.org/package/@fibjs/copy

copy file or directory recursively asynchronously.

## Install

```bash
$ npm i @fibjs/copy --save
```

## Usage

```js
const copy = require('@fibjs/copy');

copy('path to source', 'path to target');

copy('path to source', 'path to target', data => {
  // process the file buffer before write to the target
  return data.toString() + 'foo';
});

copy('path to source', 'path to target', (data, dir) => {
  if (dir.src.endsWith('xxx')) {
    // ignore this path
    return false;
  }
  return data;
});

copy('path to source', 'path to target', () => {
  // doing nothing
  return true;
});
```

## Questions & Suggestions

Please open an issue [here](https://github.com/fibjs-modules/copy/issues).

## License

[MIT](LICENSE)
npm package: @fibjs/delegates
Description: delegate methods and accessors to another property
Latest version: 0.1.1


# delegates

  Node method and accessor delegation utilty.

## Installation

```
$ npm install delegates
```

## Example

```js
var delegate = require('delegates');

...

delegate(proto, 'request')
  .method('acceptsLanguages')
  .method('acceptsEncodings')
  .method('acceptsCharsets')
  .method('accepts')
  .method('is')
  .access('querystring')
  .access('idempotent')
  .access('socket')
  .access('length')
  .access('query')
  .access('search')
  .access('status')
  .access('method')
  .access('path')
  .access('body')
  .access('host')
  .access('url')
  .getter('subdomains')
  .getter('protocol')
  .getter('header')
  .getter('stale')
  .getter('fresh')
  .getter('secure')
  .getter('ips')
  .getter('ip')
```

# API

## Delegate(proto, prop)

Creates a delegator instance used to configure using the `prop` on the given
`proto` object. (which is usually a prototype)

## Delegate#method(name)

Allows the given method `name` to be accessed on the host.

## Delegate#getter(name)

Creates a "getter" for the property with the given `name` on the delegated
object.

## Delegate#setter(name)

Creates a "setter" for the property with the given `name` on the delegated
object.

## Delegate#access(name)

Creates an "accessor" (ie: both getter *and* setter) for the property with the
given `name` on the delegated object.

## Delegate#fluent(name)

A unique type of "accessor" that works for a "fluent" API. When called as a
getter, the method returns the expected value. However, if the method is called
with a value, it will return itself so it can be chained. For example:

```js
delegate(proto, 'request')
  .fluent('query')

// getter
var q = request.query();

// setter (chainable)
request
  .query({ a: 1 })
  .query({ b: 2 });
```

# License

  MIT
npm package: @fibjs/detect-port
Description: JavaScript Implementation of Port Detector
Author: ngot
Latest version: 1.0.2

# @fibjs/detect-port

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![appveyor build status][appveyor-image]][appveyor-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/@fibjs/detect-port.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@fibjs/detect-port
[travis-image]: https://img.shields.io/travis/fibjs-modules/detect-port.svg?style=flat-square
[travis-url]: https://travis-ci.org/fibjs-modules/detect-port
[appveyor-image]: https://ci.appveyor.com/api/projects/status/34hk280r11xavawl/branch/master?svg=true
[appveyor-url]: https://ci.appveyor.com/project/ngot/detect-port
[codecov-image]: https://img.shields.io/codecov/c/github/fibjs-modules/detect-port.svg?style=flat-square
[codecov-url]: https://codecov.io/github/fibjs-modules/detect-port?branch=master
[david-image]: https://img.shields.io/david/fibjs-modules/detect-port.svg?style=flat-square
[david-url]: https://david-dm.org/fibjs-modules/detect-port
[snyk-image]: https://snyk.io/test/npm/@fibjs/detect-port/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/@fibjs/detect-port
[download-image]: https://img.shields.io/npm/dm/@fibjs/detect-port.svg?style=flat-square
[download-url]: https://npmjs.org/package/@fibjs/detect-port

JavaScript Implementation of Port Detector

## Install

```bash
$ npm i @fibjs/detect-port --save
```

## Usage

```js
const detectPort = require('@fibjs/detect-port');
const availablePort = detectPort();
```

or

```js
const detectPort = require('@fibjs/detect-port');
const port = 3000;
const availablePort = detectPort(port);
if (availablePort === port) {
  console.log(`port ${port} is available!`);
} else {
  console.log(`port ${port} is not available! Got a random available port: ${availablePort} for you.`);
}
```

## Questions & Suggestions

Please open an issue [here](https://github.com/fibjs-modules/detect-port/issues).

## License

[MIT](LICENSE)
npm package: @fibjs/fs-readdir-recursive
Description: Read a directory recursively.
Author: ngot
Latest version: 1.0.2

# @fibjs/fs-readdir-recursive

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/@fibjs/fs-readdir-recursive.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@fibjs/fs-readdir-recursive
[travis-image]: https://img.shields.io/travis/fibjs-modules/fs-readdir-recursive.svg?style=flat-square
[travis-url]: https://travis-ci.org/fibjs-modules/fs-readdir-recursive
[codecov-image]: https://img.shields.io/codecov/c/github/fibjs-modules/fs-readdir-recursive.svg?style=flat-square
[codecov-url]: https://codecov.io/github/fibjs-modules/fs-readdir-recursive?branch=master
[david-image]: https://img.shields.io/david/fibjs-modules/fs-readdir-recursive.svg?style=flat-square
[david-url]: https://david-dm.org/fibjs-modules/fs-readdir-recursive
[snyk-image]: https://snyk.io/test/npm/@fibjs/fs-readdir-recursive/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/@fibjs/fs-readdir-recursive
[download-image]: https://img.shields.io/npm/dm/@fibjs/fs-readdir-recursive.svg?style=flat-square
[download-url]: https://npmjs.org/package/@fibjs/fs-readdir-recursive

Read a directory recursively.

## Install

```bash
$ npm i @fibjs/fs-readdir-recursive --save
```

## Usage

```js
var read = require('@fibjs/fs-readdir-recursive')
read(__dirname) === [
  'test/test.js',
  'index.js',
  'LICENSE',
  'package.json',
  'README.md'
]
```

## Questions & Suggestions

Please open an issue [here](https://github.com/fibjs-modules/fs-readdir-recursive/issues).

## License

[MIT](LICENSE)
npm package: @fibjs/logstream
Description: wrap a file stream as a extremely high performance log stream.
Author: ngot
Latest version: 1.0.2

# @fibjs/logstream

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/@fibjs/logstream.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@fibjs/logstream
[travis-image]: https://img.shields.io/travis/fibjs-modules/logstream.svg?style=flat-square
[travis-url]: https://travis-ci.org/fibjs-modules/logstream
[codecov-image]: https://img.shields.io/codecov/c/github/fibjs-modules/logstream.svg?style=flat-square
[codecov-url]: https://codecov.io/github/fibjs-modules/logstream?branch=master
[david-image]: https://img.shields.io/david/fibjs-modules/logstream.svg?style=flat-square
[david-url]: https://david-dm.org/fibjs-modules/logstream
[snyk-image]: https://snyk.io/test/npm/@fibjs/logstream/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/@fibjs/logstream
[download-image]: https://img.shields.io/npm/dm/@fibjs/logstream.svg?style=flat-square
[download-url]: https://npmjs.org/package/@fibjs/logstream

wrap a file stream as a extremely high performance log stream.

## Install

```bash
$ npm i @fibjs/logstream --save
```

## Usage

```js
const fs = require('fs');
const LogStream = require('@fibjs/logstream');

const fd = fs.open('path to log file', 'w');
const bf = new LogStream(fd);
bf.writeText('some log');
bf.writeLine('new line log');
bf.end();// close the log stream.
```

## Questions & Suggestions

Please open an issue [here](https://github.com/fibjs-modules/logstream/issues).

## License

[MIT](LICENSE)
npm package: @fibjs/mime-db
Description: Media Type Database
Latest version: 1.20.3

# mime-db

[![NPM Version][npm-version-image]][npm-url]
[![NPM Downloads][npm-downloads-image]][npm-url]
[![Node.js Version][node-image]][node-url]
[![Build Status][travis-image]][travis-url]
[![Coverage Status][coveralls-image]][coveralls-url]

This is a database of all mime types.
It consists of a single, public JSON file and does not include any logic,
allowing it to remain as un-opinionated as possible with an API.
It aggregates data from the following sources:

- http://www.iana.org/assignments/media-types/media-types.xhtml
- http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
- http://hg.nginx.org/nginx/raw-file/default/conf/mime.types

## Installation

```bash
npm install mime-db
```

### Database Download

If you're crazy enough to use this in the browser, you can just grab the
JSON file using [RawGit](https://rawgit.com/). It is recommended to replace
`master` with [a release tag](https://github.com/jshttp/mime-db/tags) as the
JSON format may change in the future.

```
https://cdn.rawgit.com/jshttp/mime-db/master/db.json
```

## Usage

```js
var db = require('mime-db');

// grab data on .js files
var data = db['application/javascript'];
```

## Data Structure

The JSON file is a map lookup for lowercased mime types.
Each mime type has the following properties:

- `.source` - where the mime type is defined.
    If not set, it's probably a custom media type.
    - `apache` - [Apache common media types](http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types)
    - `iana` - [IANA-defined media types](http://www.iana.org/assignments/media-types/media-types.xhtml)
    - `nginx` - [nginx media types](http://hg.nginx.org/nginx/raw-file/default/conf/mime.types)
- `.extensions[]` - known extensions associated with this mime type.
- `.compressible` - whether a file of this type is can be gzipped.
- `.charset` - the default charset associated with this type, if any.

If unknown, every property could be `undefined`.

## Contributing

To edit the database, only make PRs against `src/custom.json` or
`src/custom-suffix.json`.

To update the build, run `npm run build`.

## Adding Custom Media Types

The best way to get new media types included in this library is to register
them with the IANA. The community registration procedure is outlined in
[RFC 6838 section 5](http://tools.ietf.org/html/rfc6838#section-5). Types
registered with the IANA are automatically pulled into this library.

[npm-version-image]: https://img.shields.io/npm/v/mime-db.svg
[npm-downloads-image]: https://img.shields.io/npm/dm/mime-db.svg
[npm-url]: https://npmjs.org/package/mime-db
[travis-image]: https://img.shields.io/travis/jshttp/mime-db/master.svg
[travis-url]: https://travis-ci.org/jshttp/mime-db
[coveralls-image]: https://img.shields.io/coveralls/jshttp/mime-db/master.svg
[coveralls-url]: https://coveralls.io/r/jshttp/mime-db?branch=master
[node-image]: https://img.shields.io/node/v/mime-db.svg
[node-url]: http://nodejs.org/download/
npm package: @fibjs/mkdirp
Description: Recursively mkdir, like `mkdir -p`
Author: ngot
Latest version: 1.1.1

# @fibjs/mkdirp

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![appveyor build status][appveyor-image]][appveyor-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/@fibjs/mkdirp.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@fibjs/mkdirp
[travis-image]: https://img.shields.io/travis/fibjs-modules/mkdirp.svg?style=flat-square
[travis-url]: https://travis-ci.org/fibjs-modules/mkdirp
[appveyor-image]: https://ci.appveyor.com/api/projects/status/089mm0c0xa9g2moo/branch/master?svg=true
[appveyor-url]: https://ci.appveyor.com/project/ngot/mkdirp
[codecov-image]: https://img.shields.io/codecov/c/github/fibjs-modules/mkdirp.svg?style=flat-square
[codecov-url]: https://codecov.io/github/fibjs-modules/mkdirp?branch=master
[david-image]: https://img.shields.io/david/fibjs-modules/mkdirp.svg?style=flat-square
[david-url]: https://david-dm.org/fibjs-modules/mkdirp
[snyk-image]: https://snyk.io/test/npm/@fibjs/mkdirp/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/@fibjs/mkdirp
[download-image]: https://img.shields.io/npm/dm/@fibjs/mkdirp.svg?style=flat-square
[download-url]: https://npmjs.org/package/@fibjs/mkdirp

Like `mkdir -p`, but in fibjs!

## Install

```bash
$ npm i @fibjs/mkdirp --save
```

## Usage

```js
const mkdirp = require('@fibjs/mkdirp');

try{
	mkdirp('/tmp/a/c/d')
} catch(err) {
	console.error(err)
}

```

then /tmp/a/c/d has beed created.

## API

- mkdirp(dir, opts)

asynchronously create a new directory and any necessary subdirectories at `dir`
with octal permission string `opts.mode`. If `opts` is a non-object, it will be
treated as the `opts.mode`.

If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.

Returns the first directory that had to be created, if any.

You can optionally pass in an alternate `fs` implementation by passing in
`opts.fs`. Your implementation should have `opts.fs.mkdir(path, mode)` and
`opts.fs.stat(path)`.

## Questions & Suggestions

Please open an issue [here](https://github.com/fibjs-modules/mkdirp/issues).

## License

[MIT](LICENSE)
npm package: @fibjs/node
Description: Node.js runtime which works on fibjs platform.
Author: ngot
Latest version: 1.0.0-beta.0

# @fibjs/node

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/@fibjs/node.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@fibjs/node
[travis-image]: https://img.shields.io/travis/fibjs-modules/node.svg?style=flat-square
[travis-url]: https://travis-ci.org/fibjs-modules/node
[codecov-image]: https://img.shields.io/codecov/c/github/fibjs-modules/node.svg?style=flat-square
[codecov-url]: https://codecov.io/github/fibjs-modules/node?branch=master
[david-image]: https://img.shields.io/david/fibjs-modules/node.svg?style=flat-square
[david-url]: https://david-dm.org/fibjs-modules/node
[snyk-image]: https://snyk.io/test/npm/@fibjs/node/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/@fibjs/node
[download-image]: https://img.shields.io/npm/dm/@fibjs/node.svg?style=flat-square
[download-url]: https://npmjs.org/package/@fibjs/node

Node.js runtime which works on fibjs platform. you should use this module only when you want use some Node.js's module, please use fibjs native module first!

## Install

```bash
$ npm i @fibjs/node --save
```

## Usage

```js
const node = require('@fibjs/node');
const mod1 = node('mod1');
const mod2 = node.require('mod2');

// or you can run a js file
node.run('./app.js'); // path to js file
```

Also, this module can be used as a cli. You can invoke like this:

```bash
$ ./node_modules/.bin/node app.js
```

## API

- `node()` require a npm module.
- `node.require()` require a npm module.
- `node.run()` execute a Node.js js script file.

## Questions & Suggestions

Please open an issue [here](https://github.com/fibjs-modules/node/issues).

## License

[MIT](LICENSE)
npm package: @fibjs/pool
Description: pool for fibjs
Author: ngot
Latest version: 1.0.0

# @fibjs/pool

pool module for fibjs.

This module can be used to implement db connection pool or other situation like this.

# Usage

```js

const pool = require('@fibjs/pool');
const db = require('db');

const sqlConnString = 'mysql://root:123456@localhost/test';
const ConnPool =  Pool(() => db.open(config), 20, 10000);

const apps = ConnPool(conn => {
    const sql = "select * from apps where appid = ? and version = ?";
    const appid = 2;
    const version = '2.3.0';
    return conn.execute(sql, appid, version);
});

```

# License

[MIT](./License)
npm package: @fibjs/rmdirr
Description: remove all files and directories like rmdir -rf in fibjs.
Author: ngot
Latest version: 2.0.0

# @fibjs/rmdirr

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![appveyor build status][appveyor-image]][appveyor-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/@fibjs/rmdirr.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@fibjs/rmdirr
[travis-image]: https://img.shields.io/travis/fibjs-modules/rmdirr.svg?style=flat-square
[travis-url]: https://travis-ci.org/fibjs-modules/rmdirr
[appveyor-image]: https://ci.appveyor.com/api/projects/status/3yoaos4qnax1n2bs/branch/master?svg=true
[appveyor-url]: https://ci.appveyor.com/project/ngot/rmdirr
[codecov-image]: https://img.shields.io/codecov/c/github/fibjs-modules/rmdirr.svg?style=flat-square
[codecov-url]: https://codecov.io/github/fibjs-modules/rmdirr?branch=master
[david-image]: https://img.shields.io/david/fibjs-modules/rmdirr.svg?style=flat-square
[david-url]: https://david-dm.org/fibjs-modules/rmdirr
[snyk-image]: https://snyk.io/test/npm/@fibjs/rmdirr/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/@fibjs/rmdirr
[download-image]: https://img.shields.io/npm/dm/@fibjs/rmdirr.svg?style=flat-square
[download-url]: https://npmjs.org/package/@fibjs/rmdirr

remove all files and directories like rmdir -rf in fibjs.

## Install

```bash
$ npm i @fibjs/rmdirr --save
```

## Usage

```js
const rmdirr = require('@fibjs/rmdirr');

try{
	rmdirr('/tmp/a/c/d/e');
} catch(err) {
	console.error(err);
}

```

## Questions & Suggestions

Please open an issue [here](https://github.com/fibjs-modules/rmdirr/issues).

## License

[MIT](LICENSE)
npm package: @fibjs/static
Description: A static server written in fibjs.
Author: ngot
Latest version: 1.0.0

# @fibjs/static

A static server written in fibjs.

## Install

```bash
$ npm i @fibjs/static -g
```

## Usage

```shell
static ./
```

## Doc

```
 Help:

 static [folder] [port]

 folder : folder of the static file to be served.
 port   : static server port. Default to 8080.
```

## Questions & Suggestions

Please open an issue [here](https://github.com/fibjs-modules/static/issues).

## License

[MIT](LICENSE)
npm package: @fibjs/sync
Description: Synchronize all kinds of async look like function to real non-blocking sync function, make the world peace and quiet!
Author: ngot
Latest version: 1.2.0

# @fibjs/sync

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![appveyor build status][appveyor-image]][appveyor-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/@fibjs/sync.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@fibjs/sync
[travis-image]: https://img.shields.io/travis/fibjs-modules/sync.svg?style=flat-square
[travis-url]: https://travis-ci.org/fibjs-modules/sync
[appveyor-image]: https://ci.appveyor.com/api/projects/status/y2ts1aseorsqbcwt/branch/master?svg=true
[appveyor-url]: https://ci.appveyor.com/project/ngot/sync
[codecov-image]: https://img.shields.io/codecov/c/github/fibjs-modules/sync.svg?style=flat-square
[codecov-url]: https://codecov.io/github/fibjs-modules/sync?branch=master
[david-image]: https://img.shields.io/david/fibjs-modules/sync.svg?style=flat-square
[david-url]: https://david-dm.org/fibjs-modules/sync
[snyk-image]: https://snyk.io/test/npm/@fibjs/sync/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/@fibjs/sync
[download-image]: https://img.shields.io/npm/dm/@fibjs/sync.svg?style=flat-square
[download-url]: https://npmjs.org/package/@fibjs/sync

Synchronize all kinds of async look like function to original non-blocking sync one, make the world peace and quiet!

## Install

```bash
$ npm i @fibjs/sync --save
```

## Usage

```js
const sync = require('@fibjs/sync');

function cb(callback) {
  callback(null, 'this is callback');
}

function pr() {
  return new Promise((resovle, reject) => {
    resovle('this is promise');
  });
}

function* ge() {
  return 'this is generator';
}

async function aa() {
  return 'this is async function';
}

// sync default to callback hanlder
const callbackSync = sync(cb);

try {
  const result = callbackSync();
} catch(e) {
  // handle the error
}

// the other apis
const newCb = sync.cb(cb);// callback
const newPr = sync.pr(pr);// promise
const newGe = sync.ge(ge);// generator
const newAa = sync.aa(aa);// async function
```

Now you can use `newCb`,`newPr`,`newGe`,`newAa` as a normal sync function and use try/catch to handle the error.

## Questions & Suggestions

Please open an issue [here](https://github.com/fibjs-modules/sync/issues).

## License

[MIT](LICENSE)
npm package: @fibjs/translate-by-google-api
Description: free and unlimited google translation api based on public web api
Author: Richard
Latest version: 0.1.1

## fibjs translate-by-google-api

[![NPM version](https://img.shields.io/npm/v/@fibjs/translate-by-google-api.svg)](https://www.npmjs.org/package/@fibjs/translate-by-google-api)

## Install

```sh
npm install @fibjs/translate-by-google-api
```

## How to use it

```js
const { translate } = require("@fibjs/translate-by-google-api");

const result = translate('<b>Hello</b>', {
    format: 'html',
    from: 'en',
    to: 'zh-CN'
})
            
assert.equal(
    result.text,
    '<b>你好</b>'
)
```

With html marks,

```js
const { translate } = require("@fibjs/translate-by-google-api");

const result = translate('<a href="https://fibjs.org">fibjs official website</a>', {
    format: 'html',
    from: 'en',
    to: 'zh-CN'
})

assert.equal(
    result.text,
    '<a href="https://fibjs.org"> fibjs官方网站</a>'
)
```

**NOTICE** make sure your environment could access google's api, maybe you need to set proxy to make http client in this package could access google's translation api, just set enviroment variable `http_proxy` or `all_proxy`.

## Test

To test, first make sure you have development dependencies installed. Go to the root folder and do:

```sh
npm install
```

Then, just run the tests.

```sh
npm test
```
npm package: @fiblab/cityproto
Description: City Proto Generated JS/TS SDK
Author: fiblab
Latest version: 2.4.5

# cityproto

CityProto is a protobuf-based data exchange format for FIBLAB projects.
It is designed to be used in Golang, Python, and JavaScript/TypeScript projects.

Documentation: [https://cityproto.readthedocs.io/en/latest/](https://cityproto.readthedocs.io/en/latest/)