MCPcopy Create free account
hub / github.com/breck7/scroll / fromDisk

Method fromDisk

external/.scrollLibs.js:17850–17860  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

17848 return str ? indent + str.replace(/\n/g, indent) : ""
17849 }
17850 static fromDisk(path) {
17851 const format = this._getFileFormat(path)
17852 const content = require("fs").readFileSync(path, "utf8")
17853 const methods = {
17854 particles: content => new Particle(content),
17855 csv: content => this.fromCsv(content),
17856 tsv: content => this.fromTsv(content)
17857 }
17858 if (!methods[format]) throw new Error(`No support for '${format}'`)
17859 return methods[format](content)
17860 }
17861 static fromFolder(folderPath, filepathPredicate = filepath => filepath !== ".DS_Store") {
17862 const path = require("path")
17863 const fs = require("fs")

Callers 2

importCommandMethod · 0.80
_formatCodeMethod · 0.80

Calls 3

_getFileFormatMethod · 0.95
fromCsvMethod · 0.95
fromTsvMethod · 0.95

Tested by

no test coverage detected