Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

482
Views
Node Fetch blobFromSync y blobFrom TypeError [ERR_INVALID_URL]: URL no válida

Estoy tratando de leer un archivo que es local en mi computadora en un blob usando la biblioteca de búsqueda de nodos, pero cada vez que lo hago, aparece este error de URL no válida. Mi código es el siguiente:

 const express = require('express'); const cors = require('cors'); const bodyParser = require("body-parser"); const fetch = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args)); const blobFromSync = (...args) => import('node-fetch').then(({ blobFromSync }) => fetch(...args)); const blobFrom = (...args) => import('node-fetch').then(({ blobFrom }) => fetch(...args)); const fileFrom = (...args) => import('node-fetch').then(({ fileFrom }) => fetch(...args)); const app = express(); const port = 3000; //Here we are configuring express to use body-parser as middle-ware. app.use(cors()) app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.json()); app.use(function (req, res, next) { res.header("Access-Control-Allow-Origin", "*") res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept") next() }); app.get('/recorded', async (req, res) => { try { let file_location = './path/to/video.mp4'; const file = fileFrom(file_location); const chunkSize = 40000 for (let start = 0; start < file.size; start += chunkSize) { const chunk = file.slice(start, start + chunkSize + 1) //Will eventuay doa fetch //await fetch(url, { method: 'post', body: chunk, headers: headers, }).then(res => res.text()) } res.status(200); res.send().end(); } catch (e) { console.log(e); } }); app.listen(port, () => { console.log(`Example app listening on port ${port}`) });

El error es el siguiente (también es indetectable):

 TypeError [ERR_INVALID_URL]: Invalid URL at new NodeError (node:internal/errors:377:5) at URL.onParseError (node:internal/url:563:9) at new URL (node:internal/url:643:5) at new Request (file:///Users/xxxxxx/Development/terminal-backend/node_modules/node-fetch/src/request.js:55:16) at file:///Users/xxxx/Development/terminal-backend/node_modules/node-fetch/src/index.js:51:19 at new Promise (<anonymous>) at fetch (file:///Users/xxxx/Development/terminal-backend/node_modules/node-fetch/src/index.js:49:9) at /Users/xxxxx/Development/terminal-backend/src/server.js:11:53 { input: './path/to/video.mp4', code: 'ERR_INVALID_URL' }

blobFromSync y blobFrom también arrojan el mismo error. Si este es un archivo local, ¿por qué obtengo una URL no válida?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!