You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/fileFromPath.ts
+39-7
Original file line number
Diff line number
Diff line change
@@ -107,9 +107,24 @@ function createFileFromPath(
107
107
/**
108
108
* Creates a `File` referencing the one on a disk by given path. Synchronous version of the `fileFromPath`
109
109
*
110
-
* @param path Path to read a file from
111
-
* @param filename Optional file name. If not presented, the path will be used to get it
112
-
* @param options File options
110
+
* @param path Path to a file
111
+
* @param filename Optional name of the file. Will be passed as the second argument in `File` constructor. If not presented, the name will be taken from the file's path.
112
+
* @param options Additional `File` options, except for `lastModified`.
113
+
*
114
+
* @example
115
+
*
116
+
* ```js
117
+
* import {FormData, File} from "formdata-node"
118
+
* import {fileFromPathSync} from "formdata-node/file-from-path"
* Creates a `File` referencing the one on a disk by given path.
135
152
*
136
-
* @param path Path to read a file from
137
-
* @param filename Optional file name. If not presented, the path will be used to get it
138
-
* @param options File options
153
+
* @param path Path to a file
154
+
* @param filename Optional name of the file. Will be passed as the second argument in `File` constructor. If not presented, the name will be taken from the file's path.
155
+
* @param options Additional `File` options, except for `lastModified`.
156
+
*
157
+
* @example
158
+
*
159
+
* ```js
160
+
* import {FormData, File} from "formdata-node"
161
+
* import {fileFromPath} from "formdata-node/file-from-path"
Copy file name to clipboardExpand all lines: readme.md
+4-5
Original file line number
Diff line number
Diff line change
@@ -405,19 +405,18 @@ Available from `formdata-node/file-from-path` subpath.
405
405
Creates a `File` referencing the one on a disk by given path.
406
406
407
407
-**{string}** path - Path to a file
408
-
-**{string}**[filename] - Name of the file. Will be passed as second argument in `File` constructor. If not presented, the file path will be used to get it.
409
-
-**{object}**[options = {}] - File options.
408
+
-**{string}**[filename] - Optional name of the file. Will be passed as the second argument in `File` constructor. If not presented, the name will be taken from the file's path.
409
+
-**{object}**[options = {}] - Additional `File` options, except for `lastModified`.
410
410
-**{string}**[options.type = ""] - Returns the media type ([`MIME`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types)) of the file represented by a `File` object.
Available from `formdata-node/file-from-path` subpath.
415
415
416
416
Creates a `File` referencing the one on a disk by given path. Synchronous version of the `fileFromPath`.
417
-
418
417
-**{string}** path - Path to a file
419
-
-**{string}**[filename] - Name of the file. Will be passed as second argument in `File` constructor. If not presented, the file path will be used to get it.
420
-
-**{object}**[options = {}] - File options.
418
+
-**{string}**[filename] - Optional name of the file. Will be passed as the second argument in `File` constructor. If not presented, the name will be taken from the file's path.
419
+
-**{object}**[options = {}] - Additional `File` options, except for `lastModified`.
421
420
-**{string}**[options.type = ""] - Returns the media type ([`MIME`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types)) of the file represented by a `File` object.
0 commit comments