MCPcopy Create free account
hub / github.com/microsoft/vscode-extension-samples / getContent

Method getContent

tree-view-sample/src/ftpExplorer.ts:81–104  ·  view source on GitHub ↗
(resource: vscode.Uri)

Source from the content-addressed store, hash-verified

79 }
80
81 public getContent(resource: vscode.Uri): Thenable<string> {
82 return this.connect().then(client => {
83 return new Promise((c, e) => {
84 client.get(resource.path.substr(2), (err, stream) => {
85 if (err) {
86 return e(err);
87 }
88
89 let string = '';
90 stream.on('data', function(buffer) {
91 if (buffer) {
92 const part = buffer.toString();
93 string += part;
94 }
95 });
96
97 stream.on('end', function() {
98 client.end();
99 c(string);
100 });
101 });
102 });
103 });
104 }
105}
106
107export class FtpTreeDataProvider implements vscode.TreeDataProvider<FtpNode>, vscode.TextDocumentContentProvider {

Callers 1

Calls 2

connectMethod · 0.95
getMethod · 0.65

Tested by

no test coverage detected