Skip to content
Myr

watcher should read files async

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Aaron Heckmann · committed by Aaron Heckmann · parent d2434b5 · Browse files · 1 file+18 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+18 added−2 removed

  • other:+18 added−2 removed

1 file+18 added−2 removed

modified:lib/express/view.js+18 added-2 removed
53 unmodified lines
5455/**56 * Cache view at the given `path`.57 *58 * @param {String} padth58 * @param {String} path59 * @return {String}60 * @api private61 */6263function cacheView(path) {64 fs.readFile(path, 'utf8', function(err, data){65 if (!err) {66 viewCache[path] = data;67 }68 })69}7071/**72 * Synchronously cache view at the given `path`.73 *74 * @param {String} path75 * @return {String}76 * @api private77 */7879function cacheViewSync(path) {80 return viewCache[path] = fs.readFileSync(path, 'utf8');81}8283/**
180 unmodified lines
264 }265266 // Cache contents267 try {252 var str = viewCache[path] || cacheView(path);268 var str = viewCache[path] || cacheViewSync(path);269 } catch (err) {270 return error(err);271 }272
23 unmodified lines