ivan-loh / mac-lookup

mac address manufacturer lookup for [node](http://nodejs.org).
14 stars 9 forks source link

Rebuild fails in mac-lookup v0.1.7 #5

Open gazdawg opened 7 years ago

gazdawg commented 7 years ago

The rebuild method fails via the documented example with the following error:

EBUSY: resource busy or locked, unlink 'C:\Work\Mac\node_modules\mac-lookup\oui.db'

The solution I found was to simply close the sqlite3 database before attempting to unlink / delete it.

That is, before the unlink call at line 88 (in the index.js source file)

fs.unlink(ml.options.sql, function(err) {

Insert this call to solve the locked resource problem

ml.options.db.close();

Hope this helps somebody out there...

N.B I am using Windows 10 and Node v4.5.0

ivan-loh commented 7 years ago

i suppose this happens when the module uses the sqlite file ( eg: accessing first ) before a rebuild is called, thanks for spotting it