Eric
Eric
Explore posts from servers
NNuxt
Created by Eric on 2/11/2025 in #❓・help
read stream from event twice
Thanks guys for your help. I had to go to another project , so I couldn't set this up, but I'll come back to it in 2 weeks. Thanks again!!
18 replies
NNuxt
Created by Eric on 2/11/2025 in #❓・help
read stream from event twice
the incoming data is a formData that needs to be sent to a Directus server. It contains data ile id, userid, etc.. and an image. I need to parse it to make two different requests to Directus. Before trying to add the size check , I read it to obtain an array aof values , filter it to create the two request. once chunks is concatenated , it is still not readable, right ? do you know how I can read it to turn it into an array of usable data objects ?
18 replies
NNuxt
Created by Eric on 2/11/2025 in #❓・help
read stream from event twice
HI ! thanks for you help ! Yes I tried a loop that reads the stream chunk by chunk, store everything in a variable, adds up the total size and stop if the size reaches the max size. But i couldn't figure out what to do with it after.
I was thinking of adding a check to Content-Length too, but it's bot perfectly safe because it is set client side. A malicious usr could temper with it.
const MAX_SIZE = 10 * 1024 * 1024; // 10MB limit
let totalSize = 0;
let chunks: Buffer[] = [];

const reader = event.node.req;

for await (const chunk of reader) {
totalSize += chunk.length;

if (totalSize > MAX_SIZE) {
console.error('Request too large')
return {
ok: false,
status: 413,
statusText: 'Request too large',
}
}

chunks.push(chunk); // Store chunk in memory for later processing
}
const MAX_SIZE = 10 * 1024 * 1024; // 10MB limit
let totalSize = 0;
let chunks: Buffer[] = [];

const reader = event.node.req;

for await (const chunk of reader) {
totalSize += chunk.length;

if (totalSize > MAX_SIZE) {
console.error('Request too large')
return {
ok: false,
status: 413,
statusText: 'Request too large',
}
}

chunks.push(chunk); // Store chunk in memory for later processing
}
this reads, measure and stores the data. But what do I do with chunks after ?
18 replies
NNuxt
Created by Artist201 on 7/26/2024 in #❓・help
Building a Desktop/Mobile web nuxt app
Yes it can access mobile features. Hussles ? Not really. To me, the main downside is that it is linked to the browser. The user could unsinstall their browser not knowing it will unistall the app, therefore risking loosing the local data. If it's really just a frontend app that mirrors a database (like facebook, twitter, etc), there wont really be data stored locally.
10 replies
NNuxt
Created by Artist201 on 7/26/2024 in #❓・help
Building a Desktop/Mobile web nuxt app
You can sell/share pwa's on app stores. and it's not "just" a shortcut. You can install the app and access it off line like a standard app.
I'm not sure I understand your question correctly. If you are looking for the most straight forward way to transform a website/webapp into a proper app, pwa is the way to go. It's efficient and really easy. You could also use flutter that lets you publish your code for the wen android and ios. But it's not as easy and straight forward.
10 replies
NNuxt
Created by Eric on 7/26/2024 in #❓・help
Proxying asset url from Directus
So I think I might have found a solution with the image module.
It provides a way to configure a provider url. When setting up the provider, you setup a baseUrl in the nuxt.config.ts file. My question is: will this url be exposed publicly ? or will it only be available server side ?
2 replies
NNuxt
Created by Artist201 on 7/26/2024 in #❓・help
Building a Desktop/Mobile web nuxt app
pwa = Progressive web app
10 replies
NNuxt
Created by Artist201 on 7/26/2024 in #❓・help
Building a Desktop/Mobile web nuxt app
have you ever built a PWA ? it's just a website/web app that can be installed on a mobile device. It gets it's own icon in the device and acts just like a normal app. The only caveat is that it is linked to the web browser. If you install it through Firefox and uninstall Firefox, the app will be uninstalled.
10 replies
NNuxt
Created by Artist201 on 7/26/2024 in #❓・help
Building a Desktop/Mobile web nuxt app
Hi!
10 replies
NNuxt
Created by Eric on 5/3/2024 in #❓・help
Middleware for OUTGOIN requests ?
thanks for you response ! but I don't see what you mean 😅
6 replies
NNuxt
Created by marvin on 4/12/2024 in #❓・help
Cannot read properties of null (reading 'previousSibling')
Sorry I took so long. do you still have the problem ?
6 replies
NNuxt
Created by marvin on 4/12/2024 in #❓・help
Cannot read properties of null (reading 'previousSibling')
Do you use the previousSibling in your code? It looks like an error because the DOM tries to acces some data that doesn't exist (yet). often because the app tries to create html elements based on data that hasn't arrived back from a fetch request.
6 replies
NNuxt
Created by Eric on 4/16/2024 in #❓・help
UseAsyncData with a request params defined by a computed property ?
Thanks for your help. I finaly took another approach, but I managed to get this to work. thanks!
9 replies
NNuxt
Created by Eric on 4/16/2024 in #❓・help
UseAsyncData with a request params defined by a computed property ?
I shouldn't expect it to re-execute it? oh. I thought that's what the goal is... what does that watch param do then ?
9 replies
NNuxt
Created by Eric on 4/16/2024 in #❓・help
UseAsyncData with a request params defined by a computed property ?
thanks for you answer ! yep sorry. this is a simplified version to make the question easier to understand, and I made somt typos when rewiting it. in my code these errors were fine. Do you know if it should technicaly work ? useAsyncData with a computed prop as queryParameters ?
9 replies
NNuxt
Created by marvin on 4/12/2024 in #❓・help
Cannot read properties of null (reading 'previousSibling')
it's probably an error in the code. It's a common error. Do you know what part of the code produces this error ?
6 replies
NNuxt
Created by Cesxhin on 4/11/2024 in #❓・help
[RESOLVED] Problem with modules
can you show the code in sideMenuMayout and also the code where you import in a page/component?
4 replies