{"library":"oss-client","title":"Aliyun OSS Node.js Client","description":"The `oss-client` package provides a robust Node.js client for Alibaba Cloud's Object Storage Service (OSS), functionally similar to Amazon S3. The current stable version is 2.5.1, released in August 2025. This library maintains an active release cadence, with minor feature updates every few months and bug fixes as needed. It leverages modern JavaScript features, exclusively using `async/await` for all operations, making asynchronous programming straightforward. A key differentiator is its strong TypeScript support and ESM-first approach since version 2.0.0, catering to contemporary Node.js development practices. It is specifically designed for Aliyun OSS, offering comprehensive object manipulation capabilities including put, get, delete, stream handling, URL generation, and ACL management, along with support for bucket and object tagging.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install oss-client"],"cli":null},"imports":["import { OSSObject } from 'oss-client';","import type { ClientOptions } from 'oss-client';","import type { PutObjectOptions } from 'oss-client';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { OSSObject } from 'oss-client';\nimport { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nconst ossObject = new OSSObject({\n  region: process.env.OSS_REGION ?? 'oss-cn-hangzhou',\n  endpoint: process.env.OSS_ENDPOINT ?? 'https://oss-cn-hangzhou.aliyuncs.com',\n  accessKeyId: process.env.OSS_ACCESS_KEY_ID ?? 'YOUR_ACCESS_KEY_ID',\n  accessKeySecret: process.env.OSS_ACCESS_KEY_SECRET ?? 'YOUR_ACCESS_KEY_SECRET',\n  bucket: process.env.OSS_BUCKET_NAME ?? 'your-bucket-name',\n});\n\nasync function uploadFile() {\n  const localFilePath = join(__dirname, 'test-file.txt');\n  // For demonstration, create a dummy file if it doesn't exist\n  try {\n    readFileSync(localFilePath);\n  } catch (error) {\n    require('node:fs').writeFileSync(localFilePath, 'Hello, Aliyun OSS!');\n  }\n\n  const remoteObjectName = 'my-test-object.txt';\n  try {\n    const result = await ossObject.put(remoteObjectName, localFilePath);\n    console.log(`Successfully uploaded: ${result.name} to ${result.url}`);\n\n    const downloadResult = await ossObject.get(remoteObjectName);\n    console.log(`Downloaded content: ${downloadResult.content?.toString()}`);\n\n    await ossObject.delete(remoteObjectName);\n    console.log(`Successfully deleted: ${remoteObjectName}`);\n  } catch (error) {\n    console.error('OSS operation failed:', error);\n  }\n}\n\nuploadFile();","lang":"typescript","description":"Demonstrates initializing the OSS client, uploading a file, retrieving its content, and then deleting the object using async/await.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}