Skip to content

Commit

Permalink
fix file-store
Browse files Browse the repository at this point in the history
  • Loading branch information
Murderlon committed Jun 6, 2024
1 parent 83a5991 commit e365497
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/file-store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,14 @@ export class FileStore extends DataStore {
*/
async create(file: Upload): Promise<Upload> {
const dirs = file.id.split('/').slice(0, -1)
const filePath = path.join(this.directory, file.id)

await fsProm.mkdir(path.join(this.directory, ...dirs), {recursive: true})
await fsProm.writeFile(path.join(this.directory, file.id), '')
await fsProm.writeFile(filePath, '')
await this.configstore.set(file.id, file)

file.storage = {type: 'file', path: filePath}

return file
}

Expand Down

0 comments on commit e365497

Please sign in to comment.