MCPcopy Create free account
hub / github.com/mscdex/ssh2 / writeAll

Function writeAll

lib/protocol/SFTP.js:2393–2416  ·  view source on GitHub ↗
(sftp, handle, buffer, offset, length, position, callback_)

Source from the content-addressed store, hash-verified

2391}
2392
2393function writeAll(sftp, handle, buffer, offset, length, position, callback_) {
2394 const callback = (typeof callback_ === 'function' ? callback_ : undefined);
2395
2396 sftp.write(handle,
2397 buffer,
2398 offset,
2399 length,
2400 position,
2401 (writeErr, written) => {
2402 if (writeErr) {
2403 return sftp.close(handle, () => {
2404 callback && callback(writeErr);
2405 });
2406 }
2407 if (written === length) {
2408 sftp.close(handle, callback);
2409 } else {
2410 offset += written;
2411 length -= written;
2412 position += written;
2413 writeAll(sftp, handle, buffer, offset, length, position, callback);
2414 }
2415 });
2416}
2417
2418class Stats {
2419 constructor(initial) {

Callers 2

tryStatMethod · 0.85
writeFileMethod · 0.85

Calls 3

callbackFunction · 0.85
writeMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…