nl_tokens: called with a directory entry as the arg
pl_tokens: function _prepopulate_metadata ( _arg , _cb ) { var entry ; try { <mask> = JSON . parse ( _arg ) ; } catch ( e ) { _cb ( ) ; return ; } var nm = path . join ( entry . parent , entry . name ) ; var k = sprintf ( FILES_KEY_FMT , nm ) ; // if already in LRU cache, return var stats = self . cache . get ( k ) ; if ( stats ) { _cb ( ) ; return ; } self . db . get ( k , function ( err , val ) { // if already in db, return if ( ! err ) { _cb ( ) ; return ; } var fh = uuid . v4 ( ) ; var info ; var cfile = path . join ( self . location , 'fscache' , fh ) ; if ( entry . type !== 'directory' ) { info = { name : entry . name , extension : 'bin' , type : 'application/octet-stream' , size : entry . size , headers : { 'last-modified' : entry . mtime } , _fhandle : fh , _cacheFile : cfile , last_stat : now } ; } else { info = { name : entry . name , extension : 'directory' , type : 'application/x-json-stream; type=directory' , headers : { 'last-modified' : entry . mtime , 'result-set-size' : 3 } , last_modified : entry . mtime , _fhandle : fh , _cacheFile : cfile , last_stat : now } ; } var k1 = sprintf ( FHANDLE_KEY_FMT , nm ) ; var k2 = sprintf ( FNAME_KEY_FMT , fh ) ; self . db . batch ( ) . put ( k , info ) . put ( k1 , fh ) . put ( k2 , nm ) . write ( function ( err2 ) { if ( ! err2 ) self . cache . set ( k , info ) ; _cb ( ) ; } ) ; } ) ; }