mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
allow to define byte-offset and byte-count when reading from a provider
This commit is contained in:
@@ -481,7 +481,7 @@ export interface ExtHostWorkspaceShape {
|
||||
export interface ExtHostFileSystemShape {
|
||||
$utimes(handle: number, resource: URI, mtime: number): TPromise<IStat>;
|
||||
$stat(handle: number, resource: URI): TPromise<IStat>;
|
||||
$read(handle: number, resource: URI): TPromise<void>;
|
||||
$read(handle: number, offset: number, count: number, resource: URI): TPromise<number>;
|
||||
$write(handle: number, resource: URI, content: number[]): TPromise<void>;
|
||||
$unlink(handle: number, resource: URI): TPromise<void>;
|
||||
$move(handle: number, resource: URI, target: URI): TPromise<IStat>;
|
||||
|
||||
@@ -48,12 +48,13 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
|
||||
$stat(handle: number, resource: URI): TPromise<IStat, any> {
|
||||
return asWinJsPromise(token => this._provider.get(handle).stat(resource));
|
||||
}
|
||||
$read(handle: number, resource: URI): TPromise<void> {
|
||||
return asWinJsPromise(token => this._provider.get(handle).read(resource, {
|
||||
report: (chunk) => {
|
||||
$read(handle: number, offset: number, count: number, resource: URI): TPromise<number> {
|
||||
const progress = {
|
||||
report: chunk => {
|
||||
this._proxy.$reportFileChunk(handle, resource, [].slice.call(chunk));
|
||||
}
|
||||
}));
|
||||
};
|
||||
return asWinJsPromise(token => this._provider.get(handle).read(resource, offset, count, progress));
|
||||
}
|
||||
$write(handle: number, resource: URI, content: number[]): TPromise<void, any> {
|
||||
return asWinJsPromise(token => this._provider.get(handle).write(resource, Buffer.from(content)));
|
||||
|
||||
Reference in New Issue
Block a user