Skip to content

Commit

Permalink
fix(android): start zip read, close zipfile when done
Browse files Browse the repository at this point in the history
  • Loading branch information
ewanharris authored and sgtcoolguy committed Oct 23, 2020
1 parent 4c5af52 commit bdf7d36
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion android/cli/commands/_build.js
Expand Up @@ -3070,7 +3070,7 @@ AndroidBuilder.prototype.generateRequireIndex = async function generateRequireIn

/**
* @param {string} jarFile filepath to JAR
* @returns {Promis<Object>} parsed JSON of the module's bindings
* @returns {Promise<Object>} parsed JSON of the module's bindings
*/
AndroidBuilder.prototype.getNativeModuleBindings = async function getNativeModuleBindings(jarFile) {
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -3098,6 +3098,7 @@ AndroidBuilder.prototype.getNativeModuleBindings = async function getNativeModul
readStream.on('data', chunk => chunks.push(chunk));
readStream.on('end', () => {
try {
zipfile.close();
const str = Buffer.concat(chunks).toString('utf8');
return resolve(JSON.parse(str));
} catch (error) {
Expand All @@ -3106,6 +3107,7 @@ AndroidBuilder.prototype.getNativeModuleBindings = async function getNativeModul
});
});
});
zipfile.readEntry();
});
});
};
Expand Down

0 comments on commit bdf7d36

Please sign in to comment.