@threekit/node-sdk
v3.0.5
Published
This is a helper package for the Threekit REST API. It allows you to use our REST API directly from Node.JS with a high level of abstraction.
Downloads
22
Maintainers
Keywords
Readme
@threekit/node-sdk
This is a helper package for the Threekit REST API. It allows you to use our REST API directly from Node.JS with a high level of abstraction.
Supported APIs
This version of the API supports these main APIs:
- Access Tokens
- Asset Jobs
- Assets
- Configurations
- Customers
- Data Tables
- Fast Compositor
- Files
- Images
- Orders
- Webhooks
Example Usage
import { threekitNodeClient } from '@threekit/node-sdk';
const tk = threekitNodeClient({
authType: 'private',
privateToken: '29443f10-c3a5-4a91-b33e-d1bdfcd8f2ec',
apiHost: 'https://preview.threekit.com'
});
const fileStream = fs.createReadStream(fileName);
const uploadedFile = await tk.files.upload(
fileStream,
'myImage.png',
'image/png'
);
const download = await tk.files.download(uploadedFile.id);
const contentFileName = path.join(tempDirectory, uploadedFile.filename);
const writeStream = fs.createWriteStream(contentFileName);
readableStream.pipe(download.data as NodeJS.ReadableStream);