Alguém me ajuda, vou compartilhar meu código github: https://github.com/JoaoIto/Library-links-node.js/tree/develop
Já aproveita e dá uma estrelinha plz, rsrs!
Basicamente, eu queria me desprender um pouco da aula e melhoras minha noção de código, estou compartilhando aqui, meu objetivo era separar a função, fazendo com que uma seria imprimir todos os objetos, outra com npm run cli:links
seria pra imprimir os links, e outra rodando com npm run cli:v-links
seria somente o status de cada url dos links, já usando a função dos links.
Mas estou tendo este erro no console:
Erro no console: `
node ./src/cli.js ./archives --valida
[ 'textoCopy.md', 'textos.md' ] ./archives/textos.md node:internal/deps/undici/undici:11457 Error.captureStackTrace(err, this); ^
TypeError: Failed to parse URL from h,t,t,p,s,:,/,/,d,e,v,e,l,o,p,e,r,.,m,o,z,i,l,l,a,.,o,r,g,/,p,t,-,B,R,/,d,o,c,s,/,W,e,b,/,H,T,M,L,/,E,l,e,m,e,n,t,/,I,n,p,u,t
at Object.fetch (node:internal/deps/undici/undici:11457:11)
at async file:///C:/Users/muril/Documents/GitHub/JavaScript/Node/library/src/httpValidity.js:6:19
at async Promise.all (index 0)
at async checkStatus (file:///C:/Users/muril/Documents/GitHub/JavaScript/Node/library/src/httpValidity.js:4:21)
at async valideLinks (file:///C:/Users/muril/Documents/GitHub/JavaScript/Node/library/src/httpValidity.js:15:18)
at async imprimeList (file:///C:/Users/muril/Documents/GitHub/JavaScript/Node/library/src/cli.js:20:7) {
[cause]: TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:399:5)
at new URL (node:internal/url:719:13)
at new Request (node:internal/deps/undici/undici:7041:25)
at fetch2 (node:internal/deps/undici/undici:10598:25)
at Object.fetch (node:internal/deps/undici/undici:11455:18) at fetch (node:internal/process/pre_execution:239:25)
at file:///C:/Users/muril/Documents/GitHub/JavaScript/Node/library/src/httpValidity.js:6:25
at Array.map ()
at checkStatus (file:///C:/Users/muril/Documents/GitHub/JavaScript/Node/library/src/httpValidity.js:5:13)
at valideLinks (file:///C:/Users/muril/Documents/GitHub/JavaScript/Node/library/src/httpValidity.js:15:24) {
input: 'h,t,t,p,s,:,/,/,d,e,v,e,l,o,p,e,r,.,m,o,z,i,l,l,a,.,o,r,g,/,p,t,-,B,R,/,d,o,c,s,/,W,e,b,/,H,T,M,L,/,E,l,e,m,e,n,t,/,I,n,p,u,t', code: 'ERR_INVALID_URL'
}
}
`