MCPcopy Create free account
hub / github.com/diffusionstudio/vits-web / writeChunks

Function writeChunks

src/piper.js:3256–3270  ·  view source on GitHub ↗
(stream, buffer, offset, length, position)

Source from the content-addressed store, hash-verified

3254 };
3255 });
3256 function writeChunks(stream, buffer, offset, length, position) {
3257 var contents = stream.node.contents;
3258 if (position >= contents.length) return 0;
3259 var size = Math.min(contents.length - position, length);
3260 if (contents.slice) {
3261 for (var i = 0; i < size; i++) {
3262 buffer[offset + i] = contents[position + i];
3263 }
3264 } else {
3265 for (var i = 0; i < size; i++) {
3266 buffer[offset + i] = contents.get(position + i);
3267 }
3268 }
3269 return size;
3270 }
3271 stream_ops.read = (stream, buffer, offset, length, position) => {
3272 FS.forceLoadFile(node);
3273 return writeChunks(stream, buffer, offset, length, position);

Callers 1

createLazyFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected