Bind the filesystem into the injectable file reader function
324050
function createReadFilePromise () {
  return (filepath) => {
    return new Promise((resolve, reject) => {
      fs.readFile(filepath, 'utf8', function (error, data) {
        if (error) {
          reject(new Error(`Cannot read ${filepath}, got: ${error}`))
        } else if (!data) {
          reject(new Error(`No content at ${filepath}`))
        } else {
          resolve(data.split('\n'))
        }
      })
    })
  }
}
541316
def inject_resource(ident_hash, file, filename, media_type):
    
    resource_hash = get_file_sha1(file)
    with db_connect() as db_conn:
        with db_conn.cursor() as cursor:
            s_ident_hash = split_ident_hash(ident_hash)
            module_ident = lookup_module_ident(*s_ident_hash)
            fileid, resource_hash = insert_file(file, media_type)
            upsert_module_file(module_ident, fileid, filename)
    return resource_hash
755034
def create_reader_instances(self,
                                filenames=None,
                                reader=None,
                                reader_kwargs=None):
        """"""
        return load_readers(filenames=filenames,
                            reader=reader,
                            reader_kwargs=reader_kwargs,
                            ppp_config_dir=self.ppp_config_dir)
709981
def bind(cls):
        
        document["show_author_picker"].bind("click", lambda x: cls.show())

        cls.storno_btn_el.bind("click", lambda x: cls.hide())
        cls.pick_btn_el.bind("click", cls.on_pick_button_pressed)
1126647
def inject_into_files(scheme_file, files):
    """"""
    for file_ in files:
        rec = Recipient(file_)
        colorscheme = rec.get_colorscheme(scheme_file)
        rec.inject_scheme(colorscheme)
        rec.write()
730921
def add_reader(self, fd, callback):
        "  "
        h = msvcrt.get_osfhandle(fd)
        self._read_fds[h] = callback
1285532
def attach(self, volume_id, instance_id, device_path):
        """"""
        return self.call("AttachVolume",
                         VolumeId=volume_id, InstanceId=instance_id,
                         Device=device_path)
577058
def bind(self, source, dest, destmeth):
        
        self.connect(source, getattr(dest, destmeth))
726256
def load_reader(reader_configs, **reader_kwargs):
    """"""
    reader_info = read_reader_config(reader_configs)
    reader_instance = reader_info['reader'](config_files=reader_configs, **reader_kwargs)
    return reader_instance
158294
def _prepare_file(fn, out_dir):
    """"""
    atropos = _get_atropos()
    cmd = "{atropos} trim --max-reads 500000 -u 22 -se {fn} -o {tx_file}"
    out_file = os.path.join(out_dir, append_stem(os.path.basename(fn), "end"))
    if file_exists(out_file):
        return out_file
    with file_transaction(out_file) as tx_file:
        do.run(cmd.format(**locals()))
    return out_file
219724
public function resolve(): FileMappingReaderInterface
    {
        $files = [
            __DIR__ . '/../templates/mapping/files',
            sprintf(
                __DIR__ . '/../templates/mapping/project/%s',
                $this->typeResolver->resolve()
            )
        ];

        return new UnixFileMappingReader(
            __DIR__ . '/../templates/files',
            getcwd(),
            ...$files
        );
    }
491990
def read_injections(self):
        
        injset = InjectionSet(self.filename, hdf_group=self.injections_group)
        injections = injset.table.view(FieldArray)
        # close the new open filehandler to self
        injset._injhandler.filehandler.close()
        return injections
985375
function injectWatcher(handler) {
        return function(module, filename) {
            fs.watchFile(filename, watcher);
            handler(module, filename);
        };
    }
752386
public static FileChannel open(FileDescriptor fd, String path,
                                   boolean readable, boolean writable,
                                   Object parent)
    {
        return new FileChannelImpl(fd, path, readable, writable, false, parent);
    }
1292728
def load(glob)
      b = binding
      Dir[glob].each do |f|
        eval(File.read(f), b, f)
      end
    end
967721
@ObjectiveCName("bindRawUploadFileWithRid:withCallback:")
    public void bindRawUploadFile(long rid, UploadFileCallback callback) {
        modules.getFilesModule().bindUploadFile(rid, callback);
    }
412311
function injectAsync(asyncList, content, usedSync, filePath) {
        if (asyncList.length === 0) {
            return content.replace(settings.resourceMapTag, '');
        }
        var subpath = settings.pageSubPath.replace('${index}', asyncCount).replace('{$hash}', fis.util.md5(filePath));
        var file = genAsyncMap(asyncList, subpath, usedSync, settings.codeGen);
        asyncCount++;
        return injectAsyncWithMap(content, file);
    }