MCPcopy
hub / github.com/plasma-umass/browsix / copy

Function copy

src/bin/cp.ts:115–137  ·  view source on GitHub ↗
(src: string, dest: string)

Source from the content-addressed store, hash-verified

113 }
114
115 function copy(src: string, dest: string): void {
116 fs.stat(src, function (oerr: any, stats: fs.Stats): void {
117 if (oerr) {
118 code = 1;
119 log(oerr.message, finished);
120 } else if (stats.isFile()) {
121 let rs: any = fs.createReadStream(src);
122 rs.on('error', onReadStreamError);
123
124 let ws: any = fs.createWriteStream(dest);
125 ws.on('error', onWriteStreamError);
126 ws.on('finish', finished);
127
128 rs.pipe(ws);
129 } else if (stats.isDirectory()) {
130 code = 1;
131 log('omitting directory ‘%s’', src, finished);
132 } else {
133 code = 1;
134 log('unrecognised command', finished);
135 }
136 });
137 }
138
139 let dest: string = args[--outstanding];
140

Callers 2

gulpfile.jsFile · 0.85
mainFunction · 0.85

Calls 6

pipeMethod · 0.80
logFunction · 0.70
statMethod · 0.65
isFileMethod · 0.65
onMethod · 0.65
isDirectoryMethod · 0.65

Tested by

no test coverage detected