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

Function FS_createPreloadedFile

src/piper.js:1855–1894  ·  view source on GitHub ↗
(
			parent,
			name,
			url,
			canRead,
			canWrite,
			onload,
			onerror,
			dontCreateFile,
			canOwn,
			preFinish,
		)

Source from the content-addressed store, hash-verified

1853 return handled;
1854 };
1855 var FS_createPreloadedFile = (
1856 parent,
1857 name,
1858 url,
1859 canRead,
1860 canWrite,
1861 onload,
1862 onerror,
1863 dontCreateFile,
1864 canOwn,
1865 preFinish,
1866 ) => {
1867 var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent;
1868 var dep = getUniqueRunDependency(`cp ${fullname}`);
1869 function processData(byteArray) {
1870 function finish(byteArray) {
1871 if (preFinish) preFinish();
1872 if (!dontCreateFile) {
1873 FS_createDataFile(parent, name, byteArray, canRead, canWrite, canOwn);
1874 }
1875 if (onload) onload();
1876 removeRunDependency(dep);
1877 }
1878 if (
1879 FS_handledByPreloadPlugin(byteArray, fullname, finish, () => {
1880 if (onerror) onerror();
1881 removeRunDependency(dep);
1882 })
1883 ) {
1884 return;
1885 }
1886 finish(byteArray);
1887 }
1888 addRunDependency(dep);
1889 if (typeof url == 'string') {
1890 asyncLoad(url, (byteArray) => processData(byteArray), onerror);
1891 } else {
1892 processData(url);
1893 }
1894 };
1895 var FS_modeStringToFlags = (str) => {
1896 var flagModes = {
1897 r: 0,

Callers

nothing calls this directly

Calls 4

getUniqueRunDependencyFunction · 0.85
addRunDependencyFunction · 0.85
asyncLoadFunction · 0.85
processDataFunction · 0.85

Tested by

no test coverage detected