diff --git a/src/content/docs/en/reference/image-service-reference.mdx b/src/content/docs/en/reference/image-service-reference.mdx index 9e9ecec688a82..8e209dfe06070 100644 --- a/src/content/docs/en/reference/image-service-reference.mdx +++ b/src/content/docs/en/reference/image-service-reference.mdx @@ -88,7 +88,7 @@ const service: LocalImageService = { quality: params.get('q'), }; }, - transform(buffer: Buffer, options: { src: string, [key: string]: any }, imageConfig): { data: Buffer, format: OutputFormat } { + transform(buffer: Uint8Array, options: { src: string, [key: string]: any }, imageConfig): { data: Uint8Array, format: OutputFormat } { const { buffer } = mySuperLibraryThatEncodesImages(options); return { data: buffer, @@ -197,7 +197,7 @@ This hook parses the generated URLs by `getURL()` back into an object with the d **Required for local services only; unavailable for external services** -`transform(buffer: Buffer, options: { src: string, [key: string]: any }, imageConfig: AstroConfig['image']): { data: Buffer, format: OutputFormat }` +`transform(buffer: Uint8Array, options: { src: string, [key: string]: any }, imageConfig: AstroConfig['image']): { data: Uint8Array, format: OutputFormat }` This hook transforms and returns the image and is called during the build to create the final asset files. @@ -214,7 +214,7 @@ This hook returns all additional attributes used to render the image as HTML, ba ### `getSrcSet()` Experimental -**Optional for both local and external services.** +**Optional for both local and external services.** `getSrcSet?: (options: ImageTransform, imageConfig: AstroConfig['image']): SrcSetValue[] | Promise;` diff --git a/src/content/docs/es/reference/image-service-reference.mdx b/src/content/docs/es/reference/image-service-reference.mdx index 28495cb9361c4..26ff2edfe085e 100644 --- a/src/content/docs/es/reference/image-service-reference.mdx +++ b/src/content/docs/es/reference/image-service-reference.mdx @@ -87,7 +87,7 @@ const service: LocalImageService = { quality: params.get('q'), }; }, - transform(buffer: Buffer, options: { src: string, [key: string]: any }, imageConfig): { data: Buffer, format: OutputFormat } { + transform(buffer: Uint8Array, options: { src: string, [key: string]: any }, imageConfig): { data: Uint8Array, format: OutputFormat } { const { buffer } = mySuperLibraryThatEncodesImages(options); return { data: buffer, @@ -140,7 +140,7 @@ export const GET: APIRoute = async ({ request }) => { const imageTransform = imageService.parseURL(new URL(request.url), imageConfig); // ... busca la imagen de imageTransform.src y guárdala en inputBuffer - const { data, format } = await imageService.transform(inputBuffer, imageTransform, imageConfig); + const { data, format } = await imageService.transform(inputBuffer, imageTransform, imageConfig); return new Response(data, { status: 200, headers: { @@ -196,7 +196,7 @@ Este hook analiza las URL generadas por `getURL()` en un objeto con las diferent **Requerido para servicios locales; no disponible para servicios externos** -`transform(buffer: Buffer, options: { src: string, [key: string]: any }, imageConfig: AstroConfig['image']): { data: Buffer, format: OutputFormat }` +`transform(buffer: Uint8Array, options: { src: string, [key: string]: any }, imageConfig: AstroConfig['image']): { data: Uint8Array, format: OutputFormat }` Este hook transforma y devuelve la imagen y se llama durante la compilación para crear los archivos de activos finales. diff --git a/src/content/docs/zh-cn/reference/image-service-reference.mdx b/src/content/docs/zh-cn/reference/image-service-reference.mdx index 7476ffe3a5818..60f81bf7ffbb4 100644 --- a/src/content/docs/zh-cn/reference/image-service-reference.mdx +++ b/src/content/docs/zh-cn/reference/image-service-reference.mdx @@ -87,7 +87,7 @@ const service: LocalImageService = { quality: params.get('q'), }; }, - transform(buffer: Buffer, options: { src: string, [key: string]: any }, imageConfig): { data: Buffer, format: OutputFormat } { + transform(buffer: Uint8Array, options: { src: string, [key: string]: any }, imageConfig): { data: Uint8Array, format: OutputFormat } { const { buffer } = mySuperLibraryThatEncodesImages(options); return { data: buffer, @@ -196,7 +196,7 @@ export type ImageTransform = { **仅本地服务需要;外部服务不可用** -`transform(buffer: Buffer, options: { src: string, [key: string]: any }, imageConfig: AstroConfig['image']): { data: Buffer, format: OutputFormat }` +`transform(buffer: Uint8Array, options: { src: string, [key: string]: any }, imageConfig: AstroConfig['image']): { data: Uint8Array, format: OutputFormat }` 该钩子转换并返回图像,并在构建过程中被调用以创建最终的资源文件。