我想知道是否可以使用现有文件的路径在 NodeJS 中创建文件对象(名称、大小、数据等)?我知道这在客户端是可能的,但我看不到 NodeJS。
换句话说,我希望在 NodeJS 中使用相同的功能:
function srcToFile(src, fileName, mimeType){
return (fetch(src)
.then(function(res){return res.arrayBuffer();})
.then(function(buf){return new File([buf], fileName, {type:mimeType});})
);
}
srcToFile('/images/logo.png', 'logo.png', 'image/png')
.then(function(file){
console.log(file);
});
Run Code Online (Sandbox Code Playgroud)
输出将类似于:
File {name: "logo.png", lastModified: 1491465000541, lastModifiedDate: Thu Apr 06 2017 09:50:00 GMT+0200 (Paris, Madrid (heure d’été)), webkitRelativePath: "", size: 49029, type:"image/png"…}
Run Code Online (Sandbox Code Playgroud) 是否可以使用 Three JS 切割网格或具有我们可以移动的平面(主要是 Y 轴)的对象?我想要显示在这张图片中的相同功能:

目标是保持网格完整,以允许用户移动平面并查看 Y 平面函数中的网格。