tree: fe2301306c5b7d248dd3a3ff6865a46605c589d9 [search]
  1. .cargo/
  2. benchmark/
  3. examples/
  4. npm/
  5. scripts/
  6. src/
  7. tests/
  8. theme/
  9. .gitignore
  10. .node-version
  11. .npmignore
  12. .npmrc
  13. .prettierignore
  14. build.rs
  15. Cargo.toml
  16. CONTRIBUTING.md
  17. DEPENDENCIES.md
  18. DEPENDENCIES.rust.tsv
  19. devbox.json
  20. devbox.lock
  21. generated.d.ts
  22. generated.js
  23. index.cjs
  24. index.d.ts
  25. index.mjs
  26. LICENSE-MPL-2.0.txt
  27. package.json
  28. pnpm-lock.yaml
  29. README.md
  30. tsconfig.json
  31. tsconfig.theme.json
  32. typedoc.json
  33. upgrade.md
  34. vitest.config.mjs
bindings/nodejs/README.md

Apache OpenDALâ„¢ Node.js Binding

npm Website

OpenDAL Architecture

A native Node.js binding for Apache OpenDAL: access S3, GCS, Azure Blob, the local filesystem, and other storage services through one API.

We release the OpenDAL Node.js binding independently of the opendal crate (Rust core). For updates and compatibility, use the Node.js binding version instead of the opendal crate version.

Useful Links

Installation

npm install opendal

Build with additional services

The npm native packages enable services-all on Linux and macOS and default on Windows. Both groups are listed in the binding's Cargo.toml.

To add FTP to the Linux or macOS release service set, run these commands from bindings/nodejs in a POSIX shell:

pnpm install --frozen-lockfile
NAPI_FEATURES=services-all,services-ftp pnpm build

On Windows, set $env:NAPI_FEATURES = "services-ftp" in PowerShell before running pnpm build to add FTP to the default services.

Layers such as RetryLayer and ThrottleLayer are built in. Exposing a new Rust layer requires Node.js binding code.

Quickstart

import { Operator } from "opendal";

async function main() {
  const op = new Operator("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();

The API is promise-based; every operation has a synchronous *Sync variant too. For configuring backends, streaming, layers (retry, timeout, logging, throttle, concurrency limits), presigned URLs, and Next.js usage, see the full user guide.

Contributing

License and Trademarks

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

Apache OpenDAL, OpenDAL, and Apache are either registered trademarks or trademarks of the Apache Software Foundation.

Third-party software

Compiled distributions include the following Mozilla Public License 2.0 components. Their source code is available from the linked project pages:

The distribution includes the MPL-2.0 text in LICENSE-MPL-2.0.txt.