Please enable JavaScript to use RhodeCode Enterprise
Commit Description:
utf8mb4
Commit Description:
utf8mb4
'use strict' ;
function VirtualFileSystem () {
this . fileSystem = {};
this . dataSystem = {};
}
VirtualFileSystem . prototype . readFileSync = function ( filename , options ) {
filename = fixFilename ( filename );
var dataContent = this . dataSystem [ filename ];
if ( typeof dataContent === 'string' && options === 'utf8' ) {
return dataContent ;
}
if ( dataContent ) {
return new Buffer ( dataContent , typeof dataContent === 'string' ? 'base64' : undefined );
}
var content = this . fileSystem [ filename ];
if ( content ) {
return content ;
}
throw 'File \'' + filename + '\' not found in virtual file system' ;
};
VirtualFileSystem . prototype . writeFileSync = function ( filename , content ) {
this . fileSystem [ fixFilename ( filename )] = content ;
};
VirtualFileSystem . prototype . bindFS = function ( data ) {
this . dataSystem = data || {};
};
function fixFilename ( filename ) {
if ( filename . indexOf ( __dirname ) === 0 ) {
filename = filename . substring ( __dirname . length );
}
if ( filename . indexOf ( '/' ) === 0 ) {
filename = filename . substring ( 1 );
}
return filename ;
}
module . exports = new VirtualFileSystem ();
Site-wide shortcuts
/
Use quick search box
g h
Goto home page
g g
Goto my private gists page
g G
Goto my public gists page
n r
New repository page
n g
New gist page
Repositories
g s
Goto summary page
g c
Goto changelog page
g f
Goto files page
g F
Goto files page with file search activated
g p
Goto pull requests page
g o
Goto repository settings
g O
Goto repository permissions settings