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

Function makeTempFileFactory

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

Source from the content-addressed store, hash-verified

498// == makeTempFile
499
500const makeTempFileFactory = (method: string): FileSystem.FileSystem["makeTempFile"] => {
501 const makeDirectory = makeTempDirectoryFactory(method)
502 return Effect.fnUntraced(function*(options) {
503 const directory = yield* makeDirectory(options)
504 const random = Crypto.randomBytes(6).toString("hex")
505 const name = Path.join(directory, options?.suffix ? `${random}${options.suffix}` : random)
506 yield* writeFile(name, new Uint8Array(0))
507 return name
508 })
509}
510const makeTempFile = makeTempFileFactory("makeTempFile")
511
512// == makeTempFileScoped

Callers 1

NodeFileSystem.tsFile · 0.70

Calls 5

makeTempDirectoryFactoryFunction · 0.70
writeFileFunction · 0.70
toStringMethod · 0.65
makeDirectoryFunction · 0.50
joinMethod · 0.45

Tested by

no test coverage detected