fix: handle case data = 0 in writeFile

This commit is contained in:
Ben Heidemann 2021-04-18 16:22:27 +01:00 committed by David Humphrey
parent 90db749ee5
commit 7bd6e5f4e1
1 changed files with 1 additions and 0 deletions

View File

@ -1873,6 +1873,7 @@ function writeFile(context, path, data, options, callback) {
if(typeof data === 'number') { if(typeof data === 'number') {
data = '' + data; data = '' + data;
} }
data = data || '';
if(typeof data !== 'string') { if(typeof data !== 'string') {
data = Buffer.from(data.toString()); data = Buffer.from(data.toString());
} }