Comparing version 4.3.22 to 4.3.23
@@ -6,3 +6,4 @@ import fs from 'fs'; | ||
watchFile: typeof fs.watchFile; | ||
createReadStream: typeof fs.createReadStream; | ||
}; | ||
export default _default; |
@@ -12,3 +12,4 @@ "use strict"; | ||
watchFile: fs_1.default.watchFile, | ||
createReadStream: fs_1.default.createReadStream, | ||
}; | ||
//# sourceMappingURL=fs.js.map |
@@ -29,6 +29,23 @@ "use strict"; | ||
const utils_1 = __importDefault(require("./utils")); | ||
const readFile = async (filepath) => { | ||
return new Promise((resolve, reject) => { | ||
const chunks = []; | ||
const stream = fs_1.default.createReadStream(filepath, { | ||
highWaterMark: 64 * 1024 * 1024, | ||
}); | ||
stream.on('data', (chunk) => { | ||
chunks.push(chunk); | ||
}); | ||
stream.on('end', () => { | ||
resolve(Buffer.concat(chunks)); | ||
}); | ||
stream.on('error', (err) => { | ||
reject(err); | ||
}); | ||
}); | ||
}; | ||
const open = async (filepath, opts, cb) => { | ||
var _a; | ||
(0, assert_1.default)(!cb, utils_1.default.legacyErrorMessage); | ||
const database = await fs_1.default.readFile(filepath); | ||
const database = await readFile(filepath); | ||
if ((0, is_gzip_1.default)(database)) { | ||
@@ -60,3 +77,3 @@ throw new Error('Looks like you are passing in a file in gzip format, please use mmdb database instead.'); | ||
} | ||
const updatedDatabase = await fs_1.default.readFile(filepath); | ||
const updatedDatabase = await readFile(filepath); | ||
cache.clear(); | ||
@@ -63,0 +80,0 @@ reader.load(updatedDatabase); |
{ | ||
"name": "maxmind", | ||
"version": "4.3.22", | ||
"version": "4.3.23", | ||
"homepage": "https://github.com/runk/node-maxmind", | ||
@@ -26,3 +26,4 @@ "description": "IP lookup using Maxmind databases", | ||
"Andrew N Golovkov @AndorCS", | ||
"Gregory Oschwald @oschwald" | ||
"Gregory Oschwald @oschwald", | ||
"Mariano Facundo Scigliano @MarianoFacundoArch" | ||
], | ||
@@ -35,14 +36,14 @@ "dependencies": { | ||
"@types/ip6addr": "0.2.6", | ||
"@types/jest": "29.5.13", | ||
"@types/jest": "29.5.14", | ||
"@types/netmask": "2.0.5", | ||
"@types/node": "20.16.10", | ||
"@types/node": "22.8.6", | ||
"@types/sinon": "17.0.3", | ||
"ip-address": "9.0.5", | ||
"ip-address": "10.0.1", | ||
"ip6addr": "0.2.5", | ||
"jest": "29.7.0", | ||
"prettier": "3.3.3", | ||
"semantic-release": "24.1.0", | ||
"sinon": "18.0.0", | ||
"semantic-release": "24.2.0", | ||
"sinon": "19.0.2", | ||
"ts-jest": "29.2.5", | ||
"typescript": "5.5.4" | ||
"typescript": "5.6.3" | ||
}, | ||
@@ -49,0 +50,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
23302
255