@odroe/fs-cos
TypeScript icon, indicating that this package has built-in type declarations

0.1.10 • Public • Published

Overview & Tutorial

Tencent Cloud Object Storage, COS filesystem adapter.

With COS client create adapter

import { fs } from '@odroe/fs';
import { COSAdapter } from '@odroe/fs-cos';
import COS from 'cos-nodejs-sdk-v5';

// Create COS client
const cos = new COS({
  SecretId: '<You secret ID>',
  SecretKey: '<You secret key>',
  // More options...
});

// Create COS adapter
const adapter = COSAdapter.forClient({
  cos,
  "<You COS bucket name>",
  "<You COS bucket region>",
});

// Register adapter
fs.registerAdapter('cos', adapter); // The `cos` is custom protocol name.

With options create adapter

import { fs } from '@odroe/fs';
import { COSAdapter, COSAdapterOptions } from '@odroe/fs-cos';

// Create options
const options: COSAdapterOptions = {
  bucket: '<Your COS bucket name>',
  region: '<Your COS bucket region>',
  // ... Other options is COS client options.
};

// Create adapter
const adapter = COSAdapter.forConfuguration(options);

// Register adapter
fs.registerAdapter('cos', adapter); // The `cos` is custom protocol name.

License

MIT license.

Package Sidebar

Install

npm i @odroe/fs-cos

Weekly Downloads

0

Version

0.1.10

License

MIT

Unpacked Size

17.2 kB

Total Files

6

Last publish

Collaborators

  • medz