Getting Started
Init the SDK
Install
npm i nvsfsdk
Environment variables
The SDK is intentionally simple: only two environment variables.
NS_HOSTNAME=https://sea.novisurf.top
NOVISURF_TOKEN=nsk_your_bucket_token_here
NS_HOSTNAME- Base hostname of the Novisurf Storage node.
- Example:
https://sea.novisurf.top - Do not include a trailing slash.
NOVISURF_TOKEN- Your bucket token (must start with
nsk_). - Sent as
X-Tokenon every request.
- Your bucket token (must start with
Initialize once, reuse everywhere
The SDK supports a singleton-style initialization so you can init at the top of your server and reuse the same client.
import { init, getInstance } from 'nvsfsdk';
init({
hostname: process.env.NS_HOSTNAME!,
token: process.env.NOVISURF_TOKEN!,
});
const ns = getInstance();
Alternative: direct construction
import Novisurf from 'nvsfsdk';
const ns = new Novisurf({
hostname: process.env.NS_HOSTNAME!,
token: process.env.NOVISURF_TOKEN!,
});
Quick sanity checks
const info = await ns.getTokenInfo();
console.log(info);
// No bucket name needed anymore!
const list = await ns.listFiles();
console.log(list.objects);
Was this page helpful?
Last updated 2 weeks ago
Built with Documentation.AI