Metadata: thuộc tính size
Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Thuộc tính chỉ đọc size của giao diện Metadata xác định kích thước, tính bằng byte, của tệp được tham chiếu hoặc đối tượng hệ thống tệp khác trên đĩa.
Giá trị
Một số cho biết kích thước của tệp tính bằng byte.
Ví dụ
Ví dụ này kiểm tra kích thước của tệp nhật ký và xóa nó nếu lớn hơn một megabyte.
workingDirectory.getFile(
"log/important.log",
{},
(fileEntry) => {
fileEntry.getMetadata((metadata) => {
if (metadata.size > 1048576) {
fileEntry.remove(() => {
/* log file removed; do something clever here */
});
}
});
},
handleError,
);
Thông số kỹ thuật
Tính năng này đã bị xóa khỏi tất cả các đặc tả và không trong quá trình được chuẩn hóa.