JavaScript文件到byte [] [英] JavaScript file to byte[]
问题描述
是否有可能从JavaScript中的路径中读取文件并创建该文件的一个字节[?]?
JavaScript有两种形式:客户端和服务器端。在客户端JavaScript中,这是不可能的,而在服务器端JavaScript中,是可能的。所以这取决于你使用的是客户端还是服务器端的JavaScript。 也就是说,客户端JavaScript更常见,如果你使用的是服务器端JavaScript,一边JavaScript,你可能会知道你的问题的答案。所以,我将要走出困境,并说否,不可能从JavaScript中读取路径并从该文件创建一个字节[/ strong]。 (另外,还不清楚你用byte []表示的意思,在使用JavaScript的时候这不是一个常见的表示法,你确定不是在谈论Java吗?Java与JavaScript完全不同:在Java中byte []是一个更常见的符号。) Is it possible to read a file in from a path in JavaScript and create a byte[] of that file? There are two forms of JavaScript: client-side and server-side. In client-side JavaScript it is not possible, while in server-side JavaScript, it is possible. So it depends on whether you are using client-side or server-side JavaScript. That said, client-side JavaScript is much more common and if you were using server-side JavaScript, you would probably know the answer to your question. So I'm going to go out on a limb and say that no, it is not possible to read in from a path in JavaScript and create a byte[] from that file. (Also, it's unclear what you mean by a byte[]; that's not a common notation when using JavaScript. Are you sure you aren't talking about Java? Java is completely different from JavaScript: in Java byte[] is a more common notation.) 这篇关于JavaScript文件到byte []的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!