UNPKG

@nos-sdk/nos-node-sdk

Version:

NOS Node.js SDK实现了NOS对象操作接口,基于此SDK能方便快速地实现JavaScript应用程序来使用NOS的对象存储服务。

45 lines (44 loc) 1.6 kB
import { Response } from 'node-fetch'; import { OperateBinaryObjectParams, OperateObjectParams, OperateOptionalBucketParams } from './type/object'; import { Resource } from './type/resource'; declare module 'node-fetch' { interface Response { data: any; } } export interface NosClientOptions { accessKey: string; accessSecret: string; endpoint: string; defaultBucket?: string; } export declare class NosBaseClient { options: NosClientOptions & { host: string; protocol: string; }; constructor(options: NosClientOptions); /** * 底层请求方法包装 * @param method 请求方法 * @param headers 头信息 * @param resource 资源信息,也会序列化到 Url 上面 * @param [body] 请求体 * @private */ protected _request(method: string, headers: any, resource: Resource, body?: any): Promise<Response>; protected handleRequestError(resp: Response): Promise<Response>; protected request(method: string, headers: any, resource: Resource, body?: any): Promise<Response>; protected requestBody(method: string, headers: any, resource: Resource, body?: any): Promise<any>; protected validateParams(params: OperateObjectParams | OperateOptionalBucketParams): { bucket: string; headers: any; resource: Resource; }; protected validateBinaryParams(params: OperateBinaryObjectParams): { sourceBucket: string; targetBucket: string; resource: Resource; headers: any; }; }