Skip to content

Latest commit

 

History

History
 
 

nodejs

OpenDAL Node.js Binding

Installation

Node.js

npm install opendal

Docs

Usage

import { Operator, Scheme } from 'opendal'

async function main() {
  const op = new Operator(Scheme.Fs, { root: '/tmp' });
  await op.write("test", "Hello, World!");
  const bs = await op.read("test");
  console.log(new TextDecoder().decode(bs));
  const meta = await op.stat("test");
  console.log(`contentLength: ${meta.contentLength}`);
}

main()

Test or Contributing

  • Install latest Rust
  • Install Node.js@10+ which fully supported Node-API

We are using corepack to specific package manager:

corepack enable

corepack is distributed with Node.js, so you do not need to specifically look for a way to install it.

Build Node.js bindings

yarn
yarn build
yarn test

License

Apache v2.0