Thank you for help Schmidt.
2014-11-22 4:09 GMT-02:00 Ryan Schmidt <[email protected]>: > > On Nov 21, 2014, at 11:57 AM, Gonçalo Diogo Bessa wrote: > > > Someone know if it's possible read a file when path is case insensitive? > > > > > > Some providers changes my path. So can't find image for client. > > > > > > fs.stat(file, function (err, stat) { > > var img = fs.readFileSync(file); > > res.contentType = path.extname(file); > > res.contentLength = stat.size; > > res.end(img, 'binary'); > > }); > > Are you saying you're getting a file-not-found error because you're on a > case-sensitive filesystem and the case of the file stored on disk is > different from the case with which you're trying to read it? If so, the > solution is to use the correct case in your code. If you're asking if there > is a way to figure out the correct case programmatically, then that's not > the correct solution to use--not in production code. If you read the > directory contents you could compare the filenames case-insensitively with > the one you're looking for, but on a case-sensitive filesystem there's no > guarantee there wouldn't be multiple matches. > > > -- > Job board: http://jobs.nodejs.org/ > New group rules: > https://gist.github.com/othiym23/9886289#file-moderation-policy-md > Old group rules: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/nodejs/E7749CBE-1440-49F0-82B7-F7FA2AAF4CE3%40ryandesign.com > . > For more options, visit https://groups.google.com/d/optout. > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAK-qeG_A0BAs7vHUWwMHL%3D5TP7nREjtqUzXz74c0Rx7Vr70jSw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
