Skip to content

Commit b845637

Browse files
docs: translate comments to English in rest/uploadToGCS.ts and improve GCS upload documentation
1 parent 8baff88 commit b845637

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

rest/uploadToGCS.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ import { toResultOkFromMaybe } from "option-t/maybe";
2121
import type { FetchError } from "./robustFetch.ts";
2222
import { type HTTPError, responseIntoResult } from "./responseIntoResult.ts";
2323

24-
/** uploadしたファイルのメタデータ */
24+
/** Metadata for the uploaded file */
2525
export interface GCSFile {
26-
/** uploadしたファイルのURL */
26+
/** URL of the uploaded file */
2727
embedUrl: string;
2828

29-
/** uploadしたファイルの名前 */
29+
/** Original name of the uploaded file */
3030
originalName: string;
3131
}
3232

@@ -36,11 +36,11 @@ export type UploadGCSError =
3636
| FileCapacityError
3737
| HTTPError;
3838

39-
/** 任意のファイルをscrapbox.ioにuploadする
39+
/** Upload any file to scrapbox.io
4040
*
41-
* @param file uploadしたいファイル
42-
* @param projectId upload先projectのid
43-
* @return 成功したら、ファイルのクラウド上のURLなどが返ってくる
41+
* @param file File to upload
42+
* @param projectId ID of the target project
43+
* @return On success, returns the file's cloud URL and other metadata
4444
*/
4545
export const uploadToGCS = async (
4646
file: File,
@@ -57,25 +57,25 @@ export const uploadToGCS = async (
5757
return verify(projectId, fileOrRequest.fileId, md5Hash, options);
5858
};
5959

60-
/** 容量を使い切ったときに発生するerror */
60+
/** Error that occurs when storage capacity is exceeded */
6161
export interface FileCapacityError extends ErrorLike {
6262
name: "FileCapacityError";
6363
}
6464

6565
interface UploadRequest {
66-
/** upload先URL */
66+
/** Signed URL for uploading the file */
6767
signedUrl: string;
6868

69-
/** uploadしたファイルに紐付けられる予定のfile id */
69+
/** File ID that will be associated with the uploaded file */
7070
fileId: string;
7171
}
7272

73-
/** ファイルのuploadを要求する
73+
/** Request file upload authorization
7474
*
75-
* @param file uploadしたいファイル
76-
* @param projectId upload先projectのid
77-
* @param md5 uploadしたいファイルのMD5 hash (16進数)
78-
* @return すでにuploadされていればファイルのURLを、まだの場合はupload先URLを返す
75+
* @param file File to upload
76+
* @param projectId ID of the target project
77+
* @param md5 MD5 hash of the file (hexadecimal)
78+
* @return Returns file URL if already uploaded, or upload destination URL if not
7979
*/
8080
const uploadRequest = async (
8181
file: File,
@@ -127,15 +127,15 @@ const uploadRequest = async (
127127
);
128128
};
129129

130-
/** Google Cloud Storage XML APIのerror
130+
/** Google Cloud Storage XML API error
131131
*
132-
* `message`には[この形式](https://cloud.google.com/storage/docs/xml-api/reference-status#http-status-and-error-codes)のXMLが入る
132+
* The `message` field contains XML in [this format](https://cloud.google.com/storage/docs/xml-api/reference-status#http-status-and-error-codes)
133133
*/
134134
export interface GCSError extends ErrorLike {
135135
name: "GCSError";
136136
}
137137

138-
/** ファイルをuploadする */
138+
/** Upload the file to storage */
139139
const upload = async (
140140
signedUrl: string,
141141
file: File,
@@ -170,7 +170,7 @@ const upload = async (
170170
);
171171
};
172172

173-
/** uploadしたファイルの整合性を確認する */
173+
/** Verify the integrity of the uploaded file */
174174
const verify = async (
175175
projectId: string,
176176
fileId: string,

0 commit comments

Comments
 (0)