1 | /// <reference types="node"/>
|
2 |
|
3 | declare const readChunk: {
|
4 | /**
|
5 | Read a chunk from a file asyncronously.
|
6 |
|
7 | @param filePath - The path to the file.
|
8 | @param startPosition - Position to start reading.
|
9 | @param length - Number of bytes to read.
|
10 | @returns The read chunk.
|
11 |
|
12 | @example
|
13 | ```
|
14 | import readChunk = require('read-chunk');
|
15 |
|
16 | // foo.txt => hello
|
17 |
|
18 | readChunk.sync('foo.txt', 1, 3);
|
19 | //=> 'ell'
|
20 | ```
|
21 | */
|
22 | (filePath: string, startPosition: number, length: number): Promise<Buffer>;
|
23 |
|
24 | /**
|
25 | Read a chunk from a file synchronously.
|
26 |
|
27 | @param filePath - The path to the file.
|
28 | @param startPosition - Position to start reading.
|
29 | @param length - Number of bytes to read.
|
30 | @returns The read chunk.
|
31 | */
|
32 | sync(filePath: string, startPosition: number, length: number): Buffer;
|
33 |
|
34 | // TODO: Remove this for the next major release
|
35 | default: typeof readChunk;
|
36 | };
|
37 |
|
38 | export = readChunk;
|