/**
 * Unlink files.
 * @function task.worker._unlinkFiles
 * @param {string[]} filenames - File names to unlink.
 * @param {function} callback - Callback when done.
 * @protected
 * @ignore
 * @author Taka Okunishi
 */
var lib = require('../../lib'),
    file = lib.file,
    forceUnlink = file.forceUnlink;

module.exports = function (filenames, callback) {
    require('async').series(
        filenames.map(function (filename) {
            return function (callback) {
                forceUnlink(filename, callback);
            };
        }),
        function (err) {
            callback(err);
        }
    );
};
