File tree 1 file changed +5
-2
lines changed
packages/form-data-parser/examples/node
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change
1
+ import * as fsp from 'node:fs/promises' ;
1
2
import * as http from 'node:http' ;
2
3
import * as os from 'node:os' ;
4
+ import * as path from 'node:path' ;
3
5
import { LocalFileStorage } from '@mjackson/file-storage/local' ;
4
6
import { parseFormData } from '@mjackson/form-data-parser' ;
5
7
import { MultipartParseError , MaxFileSizeExceededError } from '@mjackson/multipart-parser' ;
6
8
import { createRequestListener } from '@mjackson/node-fetch-server' ;
7
9
8
10
const PORT = 3000 ;
9
-
10
11
const oneMb = 1024 * 1024 ;
11
12
12
- const fileStorage = new LocalFileStorage ( os . tmpdir ( ) ) ;
13
+ const fileStorage = new LocalFileStorage (
14
+ await fsp . mkdtemp ( path . join ( os . tmpdir ( ) , 'form-data-parser-' ) ) ,
15
+ ) ;
13
16
14
17
const server = http . createServer (
15
18
createRequestListener ( async ( request ) => {
You can’t perform that action at this time.
0 commit comments