kittycad.ts

command module
v2.0.43+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2025 License: MIT Imports: 7 Imported by: 0

README

KittyCAD JS/TS API library

Fully typed js library, compatible with js and ts.

Please see CONTRIBUTING.md for how to to publish AND AN EXPLANATION BEHIND THE DERIVATION PROCESS!

Full documentation here

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() {
    // zoo.dev/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();

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL