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

Function resizeFileStorage

src/piper.js:1619–1632  ·  view source on GitHub ↗
(node, newSize)

Source from the content-addressed store, hash-verified

1617 if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0);
1618 },
1619 resizeFileStorage(node, newSize) {
1620 if (node.usedBytes == newSize) return;
1621 if (newSize == 0) {
1622 node.contents = null;
1623 node.usedBytes = 0;
1624 } else {
1625 var oldContents = node.contents;
1626 node.contents = new Uint8Array(newSize);
1627 if (oldContents) {
1628 node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes)));
1629 }
1630 node.usedBytes = newSize;
1631 }
1632 },
1633 node_ops: {
1634 getattr(node) {
1635 var attr = {};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected