Skip to content

Issue with fs.readFileand fs.unlink #199

Closed
@SteveyPugs

Description

@SteveyPugs

Version: v0.12.14
Platform: Windows 7 x64
Subsystem: N/A

I am trying to read files and remove them using chokidar and async.

The issue that happens that once every couple of files I get these errors

error:  Error: EBUSY, open 'FILENAME'
    at Error (native)

{ [Error: EBUSY, unlink 'FILENAME']
  errno: -4082,
  code: 'EBUSY',
  path: 'FILENAME' }

Here is short breakdown of my code

chokidar.watch("FOLDERNAME",{
    persistent: true
}).on("add", function(filepath){
    queue.push(filepath, function(err, results){
        if(err) logger.error(err);
        fs.unlink(filepath, function(err){
            if(err) console.error(err);
        });
    });
});

var queue = async.queue(function(filepath, callback){
    fs.readFile(filepath, function(err, fileData){
        // blah process
    });
}, 1);

Any insight or direction would be helpful. Thanks!

P.S. - I am not sure I opened the issue correctly regarding the guidelines so I apologize ahead of time.

P.P.S. - nodejs/node#7368

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions