文件操作 - string.js
返回文件管理
返回主菜单
删除本文件
文件: /var/www/OLD/node_modules/clipboardy/node_modules/get-stream/source/string.js
编辑文件内容
import {getStreamContents} from './contents.js'; import {identity, getContentsProp, throwObjectStream, getLengthProp} from './utils.js'; export async function getStreamAsString(stream, options) { return getStreamContents(stream, stringMethods, options); } const initString = () => ({contents: '', textDecoder: new TextDecoder()}); const useTextDecoder = (chunk, {textDecoder}) => textDecoder.decode(chunk, {stream: true}); const addStringChunk = (convertedChunk, {contents}) => contents + convertedChunk; const truncateStringChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize); const getFinalStringChunk = ({textDecoder}) => { const finalChunk = textDecoder.decode(); return finalChunk === '' ? undefined : finalChunk; }; const stringMethods = { init: initString, convertChunk: { string: identity, buffer: useTextDecoder, arrayBuffer: useTextDecoder, dataView: useTextDecoder, typedArray: useTextDecoder, others: throwObjectStream, }, getSize: getLengthProp, truncateChunk: truncateStringChunk, addChunk: addStringChunk, getFinalChunk: getFinalStringChunk, finalize: getContentsProp, };
修改文件时间
将文件时间修改为当前时间的前一年
删除文件