MCPcopy Index your code
hub / github.com/tensorflow/tfjs / nodeFileSystemRouter

Function nodeFileSystemRouter

tfjs-node/src/io/file_system.ts:227–243  ·  view source on GitHub ↗
(url: string|string[])

Source from the content-addressed store, hash-verified

225}
226
227export const nodeFileSystemRouter = (url: string|string[]) => {
228 if (Array.isArray(url)) {
229 if (url.every(
230 urlElement => urlElement.startsWith(NodeFileSystem.URL_SCHEME))) {
231 return new NodeFileSystem(url.map(
232 urlElement => urlElement.slice(NodeFileSystem.URL_SCHEME.length)));
233 } else {
234 return null;
235 }
236 } else {
237 if (url.startsWith(NodeFileSystem.URL_SCHEME)) {
238 return new NodeFileSystem(url.slice(NodeFileSystem.URL_SCHEME.length));
239 } else {
240 return null;
241 }
242 }
243};
244// Registration of `nodeFileSystemRouter` is done in index.ts.
245
246/**

Callers 1

Calls 1

sliceMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…