當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript node-binary-marshal.Marshal函數代碼示例

本文整理匯總了TypeScript中node-binary-marshal.Marshal函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript Marshal函數的具體用法?TypeScript Marshal怎麽用?TypeScript Marshal使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Marshal函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: cb

		this.readdir((derr: any, files: string[]) => {
			if (derr) {
				console.log('readdir: ' + derr);
				cb(-EFAULT);
				return;
			}
			files = files.filter((s: string) => s !== '.deletedFiles.log');
			files.sort();
			files = files.slice(this.off);

			let dents = files.map((n) => new fs.Dirent(-1, fs.DT.UNKNOWN, n));
			let view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
			let voff = 0;

			for (let i = 0; i < dents.length; i++) {
				let dent = dents[i];
				if (voff + dent.reclen > buf.byteLength)
					break;
				let [len, err] = Marshal(view, voff, dent, fs.DirentDef);
				if (err) {
					console.log('dirent marshal failed: ' + err);
					cb(-EFAULT);
					return;
				}
				voff += len;
				this.off++;
			}

			cb(voff);
		});
開發者ID:shivamkakkar,項目名稱:browsix,代碼行數:30,代碼來源:file.ts

示例2: sys_getsockname

function sys_getsockname(cb: Function, trap: number, arg0: any, arg1: any, arg2: any): void {
	console.log('TODO: getsockname');

	let view = new DataView(arg1.buffer, arg1.byteOffset);
	Marshal(arg1, 0, {family: 2, port: 8080, addr: '127.0.0.1'}, socket.SockAddrInDef);
	arg2.$set(socket.SockAddrInDef.length);
	setTimeout(cb, 0, [0, 0, 0]);
}
開發者ID:ExC0d3,項目名稱:browsix,代碼行數:8,代碼來源:table.ts

示例3: function

	let args = [arg0, function(err: any, fd: number, remoteAddr: string, remotePort: number): void {
		if (remoteAddr === 'localhost')
			remoteAddr = '127.0.0.1';

		let view = new DataView($acceptArray.buffer, $acceptArray.byteOffset);
		Marshal(view, 0, {family: 2, port: remotePort, addr: remoteAddr}, socket.SockAddrInDef);
		$acceptLen.$set(socket.SockAddrInDef.length);
		cb([err ? -1 : fd, 0, err ? -1 : 0]);
	}];
開發者ID:ExC0d3,項目名稱:browsix,代碼行數:9,代碼來源:table.ts


注:本文中的node-binary-marshal.Marshal函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。