|
|
@ -71,9 +71,10 @@ export class SSHFileSystem implements vscode.FileSystemProvider {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public writeFile(uri: vscode.Uri, content: Uint8Array, options: { create: boolean; overwrite: boolean; }): void | Promise<void> {
|
|
|
|
public writeFile(uri: vscode.Uri, content: Uint8Array, options: { create: boolean; overwrite: boolean; }): void | Promise<void> {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
return new Promise(async (resolve, reject) => {
|
|
|
|
|
|
|
|
const stat = await toPromise<ssh2s.Stats>(cb => this.sftp.stat(this.relative(uri.path), cb));
|
|
|
|
const array = new Buffer(0);
|
|
|
|
const array = new Buffer(0);
|
|
|
|
const stream = this.sftp.createWriteStream(this.relative(uri.path));
|
|
|
|
const stream = this.sftp.createWriteStream(this.relative(uri.path), { mode: stat.mode });
|
|
|
|
stream.on('error', reject);
|
|
|
|
stream.on('error', reject);
|
|
|
|
stream.end(content, resolve);
|
|
|
|
stream.end(content, resolve);
|
|
|
|
});
|
|
|
|
});
|
|
|
|