@ipld/car
Version:
Content Addressable aRchive format reader and writer
31 lines • 1.39 kB
TypeScript
/**
* @class
* @implements {ICarBufferReader}
*/
export class CarBufferReader extends BrowserCarBufferReader implements ICarBufferReader {
/**
* Reads a block directly from a file descriptor for an open CAR file. This
* function is **only available in Node.js** and not a browser environment.
*
* This function can be used in connection with {@link CarIndexer} which emits
* the `BlockIndex` objects that are required by this function.
*
* The user is responsible for opening and closing the file used in this call.
*
* @static
* @memberof CarBufferReader
* @param {number} fd - A file descriptor from the
* Node.js `fs` module. An integer, from `fs.open()`.
* @param {BlockIndex} blockIndex - An index pointing to the location of the
* Block required. This `BlockIndex` should take the form:
* `{cid:CID, blockLength:number, blockOffset:number}`.
* @returns {Block} A `{ cid:CID, bytes:Uint8Array }` pair.
*/
static readRaw(fd: number, blockIndex: BlockIndex): Block;
}
export const __browser: false;
export type Block = import('./api').Block;
export type BlockIndex = import('./api').BlockIndex;
export type ICarBufferReader = import('./api').CarBufferReader;
import { CarBufferReader as BrowserCarBufferReader } from './buffer-reader-browser.js';
//# sourceMappingURL=buffer-reader.d.ts.map