tree: 01cea7fe914289f56f6279fe9492731f00845dbd
  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. package.json
  27. pnpm-lock.yaml
  28. README.md
  29. tsconfig.json
  30. tsconfig.theme.json
  31. typedoc.json
  32. upgrade.md
  33. vitest.config.mjs
bindings/nodejs/README.md

Apache OpenDALâ„¢ Node.js Binding

npm Website

Useful Links

Installation

npm install opendal

Docs

To build the docs locally, please run the following commands:

# Only need to run once unless you want to update the docs theme
pnpm run build:theme

# Build the docs
pnpm run docs

Tests

Services behavior tests read necessary configs from env vars or the .env file.

You can copy .env.example to $(pwd)/.env and change the values on need, or directly set env vars with export KEY=VALUE.

Take fs for example, we need to enable bench on fs on /tmp:

OPENDAL_TEST=fs
OPENDAL_FS_ROOT=/tmp

You can run service behavior tests of enabled with the following command:

pnpm build && pnpm test

Usage

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();

Usage with Next.js

Config automatically be bundled by Next.js.

/** @type {import('next').NextConfig} */
const nextConfig = {
  serverExternalPackages: ["opendal"],
};

module.exports = nextConfig;

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.