MCPcopy Index your code
hub / github.com/nodeSolidServer/node-solid-server / migrate

Function migrate

bin/lib/migrateLegacyResources.mjs:33–52  ·  view source on GitHub ↗
(path, suffix, verbose)

Source from the content-addressed store, hash-verified

31}
32
33async function migrate (path, suffix, verbose) {
34 const files = await readdir(path)
35 for (const file of files) {
36 const fullFilePath = Path.join(path, file)
37 const stat = await lstat(fullFilePath)
38 if (stat.isFile()) {
39 if (shouldMigrateFile(file)) {
40 const newFullFilePath = getNewFileName(fullFilePath, suffix)
41 if (verbose) {
42 console.log(`${fullFilePath}\n => ${newFullFilePath}`)
43 }
44 await rename(fullFilePath, newFullFilePath)
45 }
46 } else {
47 if (shouldMigrateFolder(file)) {
48 await migrate(fullFilePath, suffix, verbose)
49 }
50 }
51 }
52}
53
54function getNewFileName (fullFilePath, suffix) {
55 return fullFilePath + suffix

Callers 1

Calls 4

readdirFunction · 0.85
shouldMigrateFileFunction · 0.85
getNewFileNameFunction · 0.85
shouldMigrateFolderFunction · 0.85

Tested by

no test coverage detected