Reference Guide
TypeScript SDK Reference for OSS
Resource Information
Package Name: | @aps_sdk/oss |
Version: | 1.0.0 |
Installing this Library
npm i @aps_sdk/oss
Learning Resources
Source Code
The source code for this library is available at https://github.com/autodesk-platform-services/aps-sdk-node.
Tutorials
The Simple Viewer tutorial on the https://tutorials.autodesk.io/ site illustrates how to use this library to store a model in a bucket. It also illustrates how to access the model for translation to the SVF2 format, so that the model can be displayed in a browser.
Code Sample
import { ObjectDetails, OssClient } from "@aps_sdk/oss";
// Access token for authentication
const ACCESS_TOKEN = "...";
// Key for the bucket where the object will be stored
const BUCKET_KEY = "...";
// Key for the object to be uploaded
const OBJECT_KEY = "...";
// Source path or data of the object to be uploaded
const FILEPATH_OR_BUFFER ="...";
// Initialize the OSS Client
const ossClient = new OssClient();
// Upload the object to the specified bucket with the given object key and source
const ObjectDetails = await ossClient.uploadObject(BUCKET_KEY, OBJECT_KEY, FILEPATH_OR_BUFFER, { accessToken: ACCESS_TOKEN});
// Log the details of the uploaded object to the console
console.log(objectDetails);
Show More
See https://github.com/autodesk-platform-services/aps-sdk-node/blob/main/samples/oss.ts for a complete code sample.
SDK to REST API Cross Reference
SDK-Only Operations
Operation Category | Operation | Method | Description |
---|---|---|---|
Objects |
Upload an Object | uploadObject | Uploads a file or stream by transparently handling operations like obtaining signed URLs, chunking large files for optimal transfer, and notifying OSS to assemble the uploaded parts. |
Download an Object | downloadObject | Downloads a file by transparently handling operations like obtaining signed download URLs. |