Skip to content

Commit c926ad2

Browse files
authored
Update article.md
1 parent 49b47e3 commit c926ad2

1 file changed

Lines changed: 15 additions & 17 deletions

File tree

4-binary/01-arraybuffer-binary-arrays/article.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
1-
# ArrayBuffer, binary arrays
1+
# ArrayBuffer، آرایه دودویی
22

3-
In web-development we meet binary data mostly while dealing with files (create, upload, download). Another typical use case is image processing.
3+
در توسعه‌ی وب ما معمولا هنگام سروکار داشتن با فایل‌ها(ساختن، بارگذاری کردن، دانلود کردن) به داده‌های دودویی برخورد می‌کنیم. یکی دیگر از استفاده‌های رایج آن پردازش تصویر می‌باشد.
44

5-
That's all possible in JavaScript, and binary operations are high-performant.
5+
همه‌ی این‌ها در جاوااسکریپت ممکن است، و عملیات‌های دودویی عملکرد بالایی دارند.
66

7-
Although, there's a bit of confusion, because there are many classes. To name a few:
7+
هرچند، اندکی احتمال اشتباه کردن وجود دارد، زیرا کلاس‌های بسیاری وجود دارند. برخی از آن‌ها عبارتند از:
88
- `ArrayBuffer`, `Uint8Array`, `DataView`, `Blob`, `File`, etc.
99

10-
Binary data in JavaScript is implemented in a non-standard way, compared to other languages. But when we sort things out, everything becomes fairly simple.
10+
داده‌های دودویی در جاوااسکریپت، نسبت به سایر زبان‌ها به شکل غیراستانداردی پیاده‌سازی شده‌اند. ولی هنگاهی که ما چیزها را مرتب می‌کنیم، همه چیز نسبتا ساده می‌شود.
1111

12-
**The basic binary object is `ArrayBuffer` -- a reference to a fixed-length contiguous memory area.**
12+
**شی دودویی پایه `ArrayBuffer` است -- یک اشاره به یک ناحیه‌ی پیوسته‌ی حافظه با طول ثابت.**
1313

14-
We create it like this:
14+
آن را به شکل زیر می‌سازیم:
1515
```js run
16-
let buffer = new ArrayBuffer(16); // create a buffer of length 16
16+
let buffer = new ArrayBuffer(16); // ساخت یک بافر با طول 16
1717
alert(buffer.byteLength); // 16
1818
```
1919

20-
This allocates a contiguous memory area of 16 bytes and pre-fills it with zeroes.
20+
این کد یک حافظه‌ی پیوسته به اندازه 16 بایت را اختصاص می‌دهد و آن را با صفر مقداردهی اولیه می‌کند.
2121

22-
```warn header="`ArrayBuffer` is not an array of something"
23-
Let's eliminate a possible source of confusion. `ArrayBuffer` has nothing in common with `Array`:
24-
- It has a fixed length, we can't increase or decrease it.
25-
- It takes exactly that much space in the memory.
26-
- To access individual bytes, another "view" object is needed, not `buffer[index]`.
22+
```هدر هشدار="`ArrayBuffer` یک آرایه از چیزی نیست." بیایید یک منبع احتمال اشتباه کردن را رفع کنیم. `ArrayBuffer` هیچ ارتباطی با آرایه ندارد:
23+
- یک طول ثابت دارد، ما نمی‌توانیم آن را کم یا زیاد کنیم.
24+
- دقیقا به همان میزان حافظه اشغال می‌کند.
25+
- برای دسترسی به بایت‌های جداگانه، یک شی "View" دیگر لازم است، نه `buffer[index]`.
2726
```
2827
29-
`ArrayBuffer` is a memory area. What's stored in it? It has no clue. Just a raw sequence of bytes.
30-
31-
**To manipulate an `ArrayBuffer`, we need to use a "view" object.**
28+
یک ناحیه از حافظه است. چه چیزی در آن ذخیره می‌شود؟ هیچ سرنخی وجود ندارد. فقط یک دنباله خالی از بایت‌ها`ArrayBuffer`.
3229
30+
**برای دستکاری کردن یک `ArrayBuffer`، ما باید از یک شی "View" استفاده کنیم.**
3331
A view object does not store anything on its own. It's the "eyeglasses" that give an interpretation of the bytes stored in the `ArrayBuffer`.
3432
3533
For instance:

0 commit comments

Comments
 (0)