pillarjs / send

Streaming static file server with Range and conditional-GET support
MIT License
798 stars 191 forks source link

Unable to read /proc/* files #212

Closed mleblebici closed 5 months ago

mleblebici commented 2 years ago

As discussed in this issue, send library is not able to return contents of files in /proc directory. It is mostly because of /proc is a pseudo file system.

mleblebici commented 2 years ago

I created this pull request to overcome this problem. I tested it with following PoC application.

const express = require('express')
const app = express()

app.get('/get', (req,res) => {
    res.download(req.query.filename)
})

app.listen(12345, function(error) {
    console.log(error)
})

It worked for /proc/* files, it also did not break anything for other valid files. I tried non-existing files, they are returning 404 as expected. For getSize function, I mainly modified the read function of nodejs-procfs.

wesleytodd commented 5 months ago

Closing this in favor of the PR.