{"id":18336527,"url":"https://github.com/onedoclabs/fileforge-node-sdk","last_synced_at":"2025-04-09T19:55:57.525Z","repository":{"id":238689624,"uuid":"797254700","full_name":"OnedocLabs/fileforge-node-sdk","owner":"OnedocLabs","description":"A Node.js library for the FileForge API","archived":false,"fork":false,"pushed_at":"2024-06-14T00:53:10.000Z","size":363,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T19:55:51.105Z","etag":null,"topics":["built-with-fern","generated-from-openapi","javascript-client","typescript-client"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OnedocLabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-07T13:42:38.000Z","updated_at":"2024-06-14T00:53:13.000Z","dependencies_parsed_at":"2024-05-18T16:23:43.042Z","dependency_job_id":"a093f4d9-d754-4935-b8c9-5c5d9e7fb04c","html_url":"https://github.com/OnedocLabs/fileforge-node-sdk","commit_stats":null,"previous_names":["onedoclabs/fileforge-node-sdk"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OnedocLabs%2Ffileforge-node-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OnedocLabs%2Ffileforge-node-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OnedocLabs%2Ffileforge-node-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OnedocLabs%2Ffileforge-node-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OnedocLabs","download_url":"https://codeload.github.com/OnedocLabs/fileforge-node-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103911,"owners_count":21048245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["built-with-fern","generated-from-openapi","javascript-client","typescript-client"],"created_at":"2024-11-05T20:08:10.110Z","updated_at":"2025-04-09T19:55:57.500Z","avatar_url":"https://github.com/OnedocLabs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fileforge TypeScript Library\n\n[![Version](https://img.shields.io/npm/v/@fileforge/client.svg)](https://www.npmjs.org/package/@fileforge/client)\n[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://buildwithfern.com/)\n\nThe Fileforge TypeScript library provides convenient access to the Fileforge API from JavaScript/TypeScript.\n\n## Documentation\n\nAPI reference documentation is available [here](https://docs.fileforge.com/api-reference/).\n\n## Installation\n\n```bash\nnpm install --save @fileforge/client\n# or\nyarn add @fileforge/client\n```\n\n## Usage\n\n```typescript\nimport { FileforgeClient, Fileforge } from \"@fileforge/client\";\nimport * as fs from \"fs\";\n\nconst fileforge = new FileforgeClient({\n    apiKey: \"...\",\n});\n\nawait fileforge.generate({\n    files: [fs.readStream(\"index.html\")],\n    options: {\n        fileName: \"output.pdf\",\n    },\n});\n```\n\n## Exception Handling\n\nWhen the API returns a non-success status code (4xx or 5xx response),\na subclass of [FileforgeError](./src/errors/FileforgeError.ts) will be thrown:\n\n```ts\nimport { FileforgeError } from '@fileforge/client';\n\ntry {\n  await fileforge.generate(...);\n} catch (err) {\n  if (err instanceof FileforgeError) {\n    console.log(err.statusCode);\n    console.log(err.message);\n    console.log(err.body);\n  }\n}\n```\n\n## Retries\n\nThe SDK is instrumented with automatic retries with exponential backoff. A request will be\nretried as long as the request is deemed retriable and the number of retry attempts has not grown larger\nthan the configured retry limit (default: 2).\n\nA request is deemed retriable when any of the following HTTP status codes is returned:\n\n-   [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)\n-   [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)\n-   [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)\n\nUse the `maxRetries` request option to configure this behavior.\n\n```ts\nconst response = await fileforge.generate(..., {\n  maxRetries: 0 // override maxRetries at the request level\n});\n```\n\n## Timeouts\n\nThe SDK defaults to a 60 second timout. Use the `timeoutInSeconds` option to\nconfigure this behavior.\n\n```ts\nconst response = await fileforge.generate(..., {\n  timeoutInSeconds: 30 // override timeout to 30s\n});\n```\n\n## Runtime compatiblity\n\nThe SDK defaults to `node-fetch` but will use the global fetch client if present. The SDK\nworks in the following runtimes:\n\nThe following runtimes are supported:\n\n-   Node.js 18+\n-   Vercel\n-   Cloudflare Workers\n-   Deno v1.25+\n-   Bun 1.0+\n-   React Native\n\n### Customizing Fetch client\n\nThe SDK provides a way for you to customize the underlying HTTP client / Fetch function. If you're\nrunning in an unsupported environment, this provides a way for you to break the glass and\nensure the SDK works.\n\n```ts\nimport { Fileforge } from '@fileforge/client';\n\nconst guesty = new Fileforge({\n  apiKey: \"...\",\n  fetcher: // provide your implementation here\n});\n```\n\n## Beta status\n\nThis SDK is in beta, and there may be breaking changes between versions without a major version update.\nTherefore, we recommend pinning the package version to a specific version in your package.json file.\nThis way, you can install the same version each time without breaking changes unless you are\nintentionally looking for the latest version.\n\n## Contributing\n\nWhile we value open-source contributions to this SDK, this library is generated programmatically.\nAdditions made directly to this library would have to be moved over to our generation code,\notherwise they would be overwritten upon the next generated release. Feel free to open a\nPR as a proof of concept, but know that we will not be able to merge it as-is.\n\nWe suggest [opening an issue](https://github.com/FlatFilers/flatfile-node/issues) first to discuss with us!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonedoclabs%2Ffileforge-node-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonedoclabs%2Ffileforge-node-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonedoclabs%2Ffileforge-node-sdk/lists"}