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

Function forceLoadFile

src/piper.js:3120–3136  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

3118 return FS.mkdev(path, mode, dev);
3119 },
3120 forceLoadFile(obj) {
3121 if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true;
3122 if (typeof XMLHttpRequest != 'undefined') {
3123 throw new Error(
3124 'Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.',
3125 );
3126 } else if (read_) {
3127 try {
3128 obj.contents = intArrayFromString(read_(obj.url), true);
3129 obj.usedBytes = obj.contents.length;
3130 } catch (e) {
3131 throw new FS.ErrnoError(29);
3132 }
3133 } else {
3134 throw new Error('Cannot load without read() or XMLHttpRequest.');
3135 }
3136 },
3137 createLazyFile(parent, name, url, canRead, canWrite) {
3138 function LazyUint8Array() {
3139 this.lengthKnown = false;

Callers

nothing calls this directly

Calls 1

intArrayFromStringFunction · 0.85

Tested by

no test coverage detected