MCPcopy Create free account
hub / github.com/Effect-TS/effect / makeTempFileFactory

Function makeTempFileFactory

packages/platform/node-shared/src/NodeFileSystem.ts:394–403  ·  view source on GitHub ↗
(method: string)

Source from the content-addressed store, hash-verified

392// == makeTempFile
393
394const makeTempFileFactory = (method: string): FileSystem.FileSystem["makeTempFile"] => {
395 const makeDirectory = makeTempDirectoryFactory(method)
396 return Effect.fnUntraced(function*(options) {
397 const directory = yield* makeDirectory(options)
398 const random = Crypto.randomBytes(6).toString("hex")
399 const name = Path.join(directory, options?.suffix ? `${random}${options.suffix}` : random)
400 yield* writeFile(name, new Uint8Array(0))
401 return name
402 })
403}
404const makeTempFile = makeTempFileFactory("makeTempFile")
405
406// == makeTempFileScoped

Callers 1

NodeFileSystem.tsFile · 0.70

Calls 6

randomBytesMethod · 0.80
joinMethod · 0.80
makeTempDirectoryFactoryFunction · 0.70
writeFileFunction · 0.70
toStringMethod · 0.65
makeDirectoryFunction · 0.50

Tested by

no test coverage detected