JavaScript is a generic, cross-platform, vendor-neutral scripting language that originates from the strong need for user interaction with the browser. With the development and progress of the Internet, JavaScript's version also continues to iterate to provide more and more features that continually enhance the user's experience.
?
A better JavaScript SDK
?
Before the H5 file API appears, the front end of the file operation is very limited, often rely on flash to handle file operations, most need to cooperate with the backend implementation. For security reasons, it is not possible for the code to get the local address of the file when it is uploaded locally, so it is impossible for a pure front end to do something similar to a picture preview.
?
Our old JavaScript SDK was limited by the historical environment at that time, only reluctantly can be used, the problem of poor user experience has been our development of small brother regret. has been committed to providing users with simple, reliable service, we hope that the user's experience of the SDK tools is easy to use and efficient. Naturally, as the H5 File API technology Matures, the JavaScript SDK is upgraded iteratively the first time after an internal discussion is fully validated. And has been released recently,
"Update information as follows:"?
?
? based on native browser API, lightweight:
?
Applies To: IE11, Edge, Chrome, Firefox, Safari and other browsers, based on the seven Cow Cloud official API built, where the upload function based on the H5 File API.based on JS-SDK, the developer can easily upload files from the browser to the seven cow cloud, and enrich the data processing of the uploaded images.
?
? The API is simple and clear:
?
We draw on the interface design pattern of RxJS,the interface of the new SDK is very simple, the user can directly in the "config" and "PutExtra" to carry out the corresponding parameter settings, we put the upload and the parameters received instead of the old version of all put to a lump, this kind of level is also relatively clear.
?
?
?
? Concurrency control:
?
The old version of the SDK in the time of the upload is synchronous serial, the other pieces must wait for the previous upload success before uploading, which is actually a waste of time and reduce the use of browser resources, so in the new version of the SDK we are optimized to concurrency in the multipart upload, and added concurrency control,users can set the number of concurrent requests through Config.thread?。 Implementing the maximum concurrency depends only on the browser's own restrictions that the user is using.
?
? MD5 check:
?
The new SDK provides MD5 verification that users do not have to worry about files being modified without uploading successfully, resulting in the final error file, which can be set by the user through the CONFIG.CHECKBYMD5 to enable the MD5 check to be turned on.
?
? Combination API with third-party plugins for compatibility with older browsers:
?
JS-SDK compatible with browsers that support the H5 File API, under the lower version of the browser, additional plugins such as PLUPLOAD,JS-SDK provide some interfaces that can be combined with the plugin to upload work. We stripped the plugin's references in the new SDK,for users who need to be compatible with a low-version browser, they can refer to the plugin themselves and develop it in conjunction with the interface provided by the new SDK.
?
? Optimization of image processing:
?
The SDK provides image processing interfaces such as watermarks, thumbnails, and rotations, and optimizes the original asynchronous request interface with promise based on the previous version. You can visit the http://jssdk-v2.demo.qiniu.io/to experience our demo.
?
e.g. upload images and image processing effects as follows:
?
?
Instant use
?
The new JavaScript SDK currently supports several installation options, and users can choose from their own development habits:
1. Use the static file address directly:
?
https://unpkg.com/[email protected]<version>/dist/qiniu.min.js
By introducing the file through the Sctipt tag, an object named? Qiniu is generated globally.
?
2. Installing with NPM
?
The full name of NPM is node Package Manager, a NodeJS pack management and distribution tool that is now the unofficial standard for publishing node modules (packages). For more detailed instructions on how to use NPM, you can visit the official NPM website or the corresponding Chinese website.
?
?
3. Compiling by source code
?
git clone [email protected]:qiniu/js-sdk.git, go to the project root to execute? NPM install?, execute the NPM run build, the Dist directory can be generated? qiniu.min.js.
?
?
Object Store JavaScript SDK updates for a simpler and more reliable service