@kittycad/lib
TypeScript icon, indicating that this package has built-in type declarations

0.0.56 • Public • Published

KittyCAD JS/TS API library

Fully typed js library, compatible with js and ts.

Simple example below.

Install

npm install @kittycad/lib
# or
yarn add @kittycad/lib

## set your token
export KITTYCAD_TOKEN=<your token>

Basic example

import { file } from '@kittycad/lib';
import fsp from 'fs/promises';

async function main() {
    // kittycad.io/docs/api/get-cad-file-mass?lang=typescript
    const response = await file.create_file_mass({
      src_format: 'obj',
      material_density_unit: 'kg:m3',
      output_unit: 'g',
      material_density: 0.007,
      body: await fsp.readFile('./example.obj', 'base64'),
    })
    if ('error_code' in response) throw 'error'

    const { status, mass } = response
    console.log(status, mass);
}

main();

Package Sidebar

Install

npm i @kittycad/lib

Weekly Downloads

2,069

Version

0.0.56

License

MIT

Unpacked Size

606 kB

Total Files

524

Last publish

Collaborators

  • franknoirot_zoo
  • paultag
  • irevdev
  • jess