How to use sha1-file - 1 common examples

To help you get started, we’ve selected a few sha1-file examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wojtkowiak / meteor-desktop / tests / helpers / autoupdate / meteorServer.js View on Github external
function setETag(req, res, next) {
            const parsedUrl = url.parse(req.url);
            let { pathname } = parsedUrl;
            if (pathname === '/') {
                pathname = '/index.html';
            }
            if (
                exists(path.join(serverPath, pathname))
            ) {
                res.setHeader('ETag', `"${sha1File(path.join(serverPath, pathname))}"`);
            }
            if (parentServerPath &&
                exists(path.join(parentServerPath, pathname))) {
                res.setHeader('ETag', `"${sha1File(path.join(parentServerPath, pathname))}"`);
            }
            next();
        }

sha1-file

Get the SHA1 of a file.

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis

Popular sha1-file functions