Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,13 @@ function fromBufferWithMime( type, bufferContent, options, cb, withPath ) {
bufferContent &&
bufferContent instanceof Buffer &&
( typeof options === 'function' || typeof cb === 'function' ) ) {
if(typeof options === 'function') { cb = options; options = {} }
_writeBufferToDisk( bufferContent, function( newPath ) {
fromFileWithMimeAndPath( type, newPath, options, cb );
fromFileWithMimeAndPath( type, newPath, options, function( err, text ) {
// Remove temporary file regardless of error, ignore error on unlink
fs.unlink(newPath, function() {})
if(cb) cb( err, text )
});
});
} else {
_returnArgsError( arguments );
Expand Down