403Webshell
Server IP : 209.209.40.120  /  Your IP : 216.73.217.112
Web Server : Microsoft-IIS/10.0
System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586
User : NEWWWW$ ( 0)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/framework7/cordova/node_modules/read-chunk/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/framework7/cordova/node_modules/read-chunk/index.js
'use strict';
const fs = require('fs');
const pify = require('pify');
const withOpenFile = require('with-open-file');

const fsReadP = pify(fs.read, {multiArgs: true});

const readChunk = (filePath, startPosition, length) => {
	const buffer = Buffer.alloc(length);

	return withOpenFile(filePath, 'r', fileDescriptor =>
		fsReadP(fileDescriptor, buffer, 0, length, startPosition)
	)
		.then(([bytesRead, buffer]) => {
			if (bytesRead < length) {
				buffer = buffer.slice(0, bytesRead);
			}

			return buffer;
		});
};

module.exports = readChunk;
// TODO: Remove this for the next major release
module.exports.default = readChunk;

module.exports.sync = (filePath, startPosition, length) => {
	let buffer = Buffer.alloc(length);

	const bytesRead = withOpenFile.sync(filePath, 'r', fileDescriptor =>
		fs.readSync(fileDescriptor, buffer, 0, length, startPosition)
	);

	if (bytesRead < length) {
		buffer = buffer.slice(0, bytesRead);
	}

	return buffer;
};

Youez - 2016 - github.com/yon3zu
LinuXploit