Optimized version of fromArray

- Support to set the length;
- Performance issue for big files (if in for).