@ethersphere/bee-js
Version:
Javascript client for Bee
42 lines (41 loc) • 2.31 kB
TypeScript
/// <reference types="node" />
import { Readable } from 'stream';
import { BeeRequestOptions, Collection, CollectionUploadOptions, DownloadOptions, FileData, FileUploadOptions, UploadResult } from '../types';
import { Bytes } from '../utils/bytes';
import { ResourceLocator } from '../utils/resource-locator';
import { BatchId, Reference } from '../utils/typed-bytes';
/**
* Upload single file
*
* @param requestOptions Options for making requests
* @param data Files data
* @param postageBatchId Postage BatchId that will be assigned to uploaded data
* @param name Name that will be attached to the uploaded file. Wraps the data into manifest with set index document.
* @param options
*/
export declare function uploadFile(requestOptions: BeeRequestOptions, data: string | Uint8Array | Readable | ArrayBuffer, postageBatchId: BatchId, name?: string, options?: FileUploadOptions): Promise<UploadResult>;
/**
* Download single file as a buffer
*
* @param requestOptions Options for making requests
* @param hash Bee file or collection hash
* @param path If hash is collection then this defines path to a single file in the collection
*/
export declare function downloadFile(requestOptions: BeeRequestOptions, resource: ResourceLocator, path?: string, options?: DownloadOptions): Promise<FileData<Bytes>>;
/**
* Download single file as a readable stream
*
* @param requestOptions Options for making requests
* @param hash Bee file or collection hash
* @param path If hash is collection then this defines path to a single file in the collection
*/
export declare function downloadFileReadable(requestOptions: BeeRequestOptions, reference: Reference, path?: string, options?: DownloadOptions): Promise<FileData<ReadableStream<Uint8Array>>>;
/*******************************************************************************************************************/
/**
* Upload collection
* @param requestOptions Options for making requests
* @param collection Collection of Uint8Array buffers to upload
* @param postageBatchId Postage BatchId that will be assigned to uploaded data
* @param options
*/
export declare function uploadCollection(requestOptions: BeeRequestOptions, collection: Collection, postageBatchId: BatchId, options?: CollectionUploadOptions): Promise<UploadResult>;