11# Cas Parser TypeScript API Library
22
3- [ ![ NPM version] ( < https://img.shields.io/npm/v/cas-parser.svg?label=npm%20(stable) > )] ( https://npmjs.org/package/cas-parser ) ![ npm bundle size] ( https://img.shields.io/bundlephobia/minzip/cas-parser )
3+ [ ![ NPM version] ( < https://img.shields.io/npm/v/cas-parser-node .svg?label=npm%20(stable) > )] ( https://npmjs.org/package/cas-parser-node ) ![ npm bundle size] ( https://img.shields.io/bundlephobia/minzip/cas-parser-node )
44
55This library provides convenient access to the Cas Parser REST API from server-side TypeScript or JavaScript.
66
@@ -11,7 +11,7 @@ It is generated with [Stainless](https://www.stainless.com/).
1111## Installation
1212
1313``` sh
14- npm install cas-parser
14+ npm install cas-parser-node
1515```
1616
1717## Usage
@@ -20,7 +20,7 @@ The full API of this library can be found in [api.md](api.md).
2020
2121<!-- prettier-ignore -->
2222``` js
23- import CasParser from ' cas-parser' ;
23+ import CasParser from ' cas-parser-node ' ;
2424
2525const client = new CasParser ({
2626 apiKey: process .env [' CAS_PARSER_API_KEY' ], // This is the default and can be omitted
@@ -38,7 +38,7 @@ This library includes TypeScript definitions for all request params and response
3838
3939<!-- prettier-ignore -->
4040``` ts
41- import CasParser from ' cas-parser' ;
41+ import CasParser from ' cas-parser-node ' ;
4242
4343const client = new CasParser ({
4444 apiKey: process .env [' CAS_PARSER_API_KEY' ], // This is the default and can be omitted
@@ -50,35 +50,6 @@ const unifiedResponse: CasParser.UnifiedResponse = await client.casParser.camsKf
5050
5151Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
5252
53- ## File uploads
54-
55- Request parameters that correspond to file uploads can be passed in many different forms:
56-
57- - ` File ` (or an object with the same structure)
58- - a ` fetch ` ` Response ` (or an object with the same structure)
59- - an ` fs.ReadStream `
60- - the return value of our ` toFile ` helper
61-
62- ``` ts
63- import fs from ' fs' ;
64- import CasParser , { toFile } from ' cas-parser' ;
65-
66- const client = new CasParser ();
67-
68- // If you have access to Node `fs` we recommend using `fs.createReadStream()`:
69- await client .casParser .camsKfintech ({ pdf_file: fs .createReadStream (' /path/to/file' ) });
70-
71- // Or if you have the web `File` API you can pass a `File` instance:
72- await client .casParser .camsKfintech ({ pdf_file: new File ([' my bytes' ], ' file' ) });
73-
74- // You can also pass a `fetch` `Response`:
75- await client .casParser .camsKfintech ({ pdf_file: await fetch (' https://somesite/file' ) });
76-
77- // Finally, if none of the above are convenient, you can use our `toFile` helper:
78- await client .casParser .camsKfintech ({ pdf_file: await toFile (Buffer .from (' my bytes' ), ' file' ) });
79- await client .casParser .camsKfintech ({ pdf_file: await toFile (new Uint8Array ([0 , 1 , 2 ]), ' file' ) });
80- ```
81-
8253## Handling errors
8354
8455When the library is unable to connect to the API,
@@ -190,7 +161,7 @@ The log level can be configured in two ways:
1901612 . Using the ` logLevel ` client option (overrides the environment variable if set)
191162
192163``` ts
193- import CasParser from ' cas-parser' ;
164+ import CasParser from ' cas-parser-node ' ;
194165
195166const client = new CasParser ({
196167 logLevel: ' debug' , // Show all log messages
@@ -218,7 +189,7 @@ When providing a custom logger, the `logLevel` option still controls which messa
218189below the configured level will not be sent to your logger.
219190
220191``` ts
221- import CasParser from ' cas-parser' ;
192+ import CasParser from ' cas-parser-node ' ;
222193import pino from ' pino' ;
223194
224195const logger = pino ();
@@ -287,7 +258,7 @@ globalThis.fetch = fetch;
287258Or pass it to the client:
288259
289260``` ts
290- import CasParser from ' cas-parser' ;
261+ import CasParser from ' cas-parser-node ' ;
291262import fetch from ' my-fetch' ;
292263
293264const client = new CasParser ({ fetch });
@@ -298,7 +269,7 @@ const client = new CasParser({ fetch });
298269If you want to set custom ` fetch ` options without overriding the ` fetch ` function, you can provide a ` fetchOptions ` object when instantiating the client or making a request. (Request-specific options override client options.)
299270
300271``` ts
301- import CasParser from ' cas-parser' ;
272+ import CasParser from ' cas-parser-node ' ;
302273
303274const client = new CasParser ({
304275 fetchOptions: {
@@ -315,7 +286,7 @@ options to requests:
315286<img src =" https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg " align =" top " width =" 18 " height =" 21 " > ** Node** <sup >[[ docs] ( https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch )] </sup >
316287
317288``` ts
318- import CasParser from ' cas-parser' ;
289+ import CasParser from ' cas-parser-node ' ;
319290import * as undici from ' undici' ;
320291
321292const proxyAgent = new undici .ProxyAgent (' http://localhost:8888' );
@@ -329,7 +300,7 @@ const client = new CasParser({
329300<img src =" https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg " align =" top " width =" 18 " height =" 21 " > ** Bun** <sup >[[ docs] ( https://bun.sh/guides/http/proxy )] </sup >
330301
331302``` ts
332- import CasParser from ' cas-parser' ;
303+ import CasParser from ' cas-parser-node ' ;
333304
334305const client = new CasParser ({
335306 fetchOptions: {
@@ -341,7 +312,7 @@ const client = new CasParser({
341312<img src =" https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg " align =" top " width =" 18 " height =" 21 " > ** Deno** <sup >[[ docs] ( https://docs.deno.com/api/deno/~/Deno.createHttpClient )] </sup >
342313
343314``` ts
344- import CasParser from ' npm:cas-parser' ;
315+ import CasParser from ' npm:cas-parser-node ' ;
345316
346317const httpClient = Deno .createHttpClient ({ proxy: { url: ' http://localhost:8888' } });
347318const client = new CasParser ({
0 commit comments