nuxt-file-storage 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -108,18 +108,20 @@ const submit = async () => {
|
|
|
108
108
|
using Nitro Server Engine, we will make an api route that recieves the files and stores them in the folder `userFiles`
|
|
109
109
|
```ts
|
|
110
110
|
export default defineEventHandler(async (event) => {
|
|
111
|
-
const {
|
|
111
|
+
const { files } = await readBody<{ files: File[] }>(event)
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
for ( const file of files ) {
|
|
114
|
+
await storeFileLocally(
|
|
115
|
+
file.content, // the stringified version of the file
|
|
116
|
+
8, // you can add a name for the file or length of Unique ID that will be automatically generated!
|
|
117
|
+
'/userFiles' // the folder the file will be stored in
|
|
118
|
+
)
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
// {OR}
|
|
120
121
|
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
// Parses a data URL and returns an object with the binary data and the file extension.
|
|
123
|
+
const { binaryString, ext } = parseDataUrl(file.content)
|
|
124
|
+
}
|
|
123
125
|
|
|
124
126
|
return 'success!'
|
|
125
127
|
})
|
package/dist/module.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-file-storage",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Easy solution to store files in your nuxt apps. Be able to upload files from the frontend and recieve them from the backend to then save the files in your project.",
|
|
5
5
|
"repository": "NyllRE/nuxt-file-storage",
|
|
6
6
|
"license": "MIT",
|