You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[`fileStorageUploadSessionsGet`](docs/sdks/uploadsessions/README.md#get) - Get Upload Session
869
+
-[`fileStorageUploadSessionsUpload`](docs/sdks/uploadsessions/README.md#upload) - Upload part of File to Upload Session
852
870
-[`hrisCompaniesCreate`](docs/sdks/apideckcompanies/README.md#create) - Create Company
853
871
-[`hrisCompaniesDelete`](docs/sdks/apideckcompanies/README.md#delete) - Delete Company
854
872
-[`hrisCompaniesGet`](docs/sdks/apideckcompanies/README.md#get) - Get Company
@@ -973,6 +991,49 @@ run();
973
991
```
974
992
<!-- End Pagination [pagination] -->
975
993
994
+
<!-- Start File uploads [file-upload] -->
995
+
## File uploads
996
+
997
+
Certain SDK methods accept files as part of a multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
998
+
999
+
> [!TIP]
1000
+
>
1001
+
> Depending on your JavaScript runtime, there are convenient utilities that return a handle to a file without reading the entire contents into memory:
1002
+
>
1003
+
> -**Node.js v20+:** Since v20, Node.js comes with a native `openAsBlob` function in [`node:fs`](https://nodejs.org/docs/latest-v20.x/api/fs.html#fsopenasblobpath-options).
1004
+
> -**Bun:** The native [`Bun.file`](https://bun.sh/docs/api/file-io#reading-files-bun-file) function produces a file handle that can be used for streaming file uploads.
1005
+
> -**Browsers:** All supported browsers return an instance to a [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) when reading the value from an `<input type="file">` element.
1006
+
> -**Node.js v18:** A file stream can be created using the `fileFrom` helper from [`fetch-blob/from.js`](https://www.npmjs.com/package/fetch-blob).
1007
+
1008
+
```typescript
1009
+
import { Apideck } from"@apideck/unify";
1010
+
import { openAsBlob } from"node:fs";
1011
+
1012
+
const apideck =newApideck({
1013
+
apiKey: process.env["APIDECK_API_KEY"] ??"",
1014
+
consumerId: "test-consumer",
1015
+
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1016
+
});
1017
+
1018
+
asyncfunction run() {
1019
+
const result =awaitapideck.accounting.attachments.upload({
|`reportGeneratedAt`|[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)|:heavy_minus_sign:| The exact date and time the report was generated. | 2024-11-14T12:00:00.000Z |
49
+
|`reportAsOfDate`|[RFCDate](../../types/rfcdate.md)|:heavy_minus_sign:| The cutoff date for transactions included in the report. | 2024-11-13 |
50
+
|`periodCount`|*number*|:heavy_minus_sign:| Number of aging periods shown in the report. | 4 |
51
+
|`periodLength`|*number*|:heavy_minus_sign:| Length of each aging period in days. | 30 |
0 commit comments