Fxiaoke Developer Manual Fxiaoke Developer Manual
  • APL Development Manual
  • PWC Development Manual
  • OpenAPI Documentation
  • Quick Start
  • API Authorization
  • API Basics
  • OpenAPI
  • SSO Integration
  • Client Development
  • FAQ
  • OpenApi Version V1 (opens new window)
  • 简体中文
  • English
  • Quick Start
  • API Authorization
  • API Basics
  • OpenAPI
  • SSO Integration
  • Client Development
  • FAQ
  • OpenApi Version V1 (opens new window)
  • 简体中文
  • English
  • Quick Start

  • API Authorization

  • API Basics

  • OpenAPI

  • SSO Integration

  • Client Development

    • Integration Guide

    • JavaScript API

      • Container
      • Device
      • Launcher
      • Webview
      • Modal
      • Fxiaoke
      • Media
        • Utilities
      • UI Components

    • FAQ

    Table of Contents

    Media

    # File

    API Name Description
    media.file.download Download file
    media.file.preview Preview file

    # File Download

    This API is only available for Android systems.

    FSOpen.media.file.download({
        fileUrl: 'N_201606_29_f13bbed15ba14413bc0aef29be255817.docx',
        fileName: 'Fxiaoke JSAPI Development Documentation.docx',
        onProgress: function(resp) {
            console.log(resp.loaded, resp.total);
        },
        onSuccess: function(resp) {
            console.log(resp.fileLocalPath);
        },
        onFail: function(error) {
            alert('Failed to download, error code: ' + error.errorCode);
        }
    });
    

    Method: FSOpen.media.file.download
    JS Version: 2.0.0
    Client Support: 5.4.0 and above

    Parameters:

    Parameter Type Required Description
    fileUrl String Yes File URL to download, supports N-Path addresses and standard HTTP URLs
    fileName String Yes Name for the downloaded file
    onProgress Function No Download progress callback

    onProgress callback parameters:

    Parameter Type Description
    loaded Number Downloaded file size in bytes
    total Number Total file size in bytes

    Success callback parameters:

    Parameter Type Description
    fileLocalPath String Local path of the downloaded file

    # File Preview

    Sample code:

    FSOpen.media.file.preview({
        fileNPath: 'N_201606_29_f13bbed15ba14413bc0aef29be255817.docx',
        onSuccess: function(resp) {
            // do sth
        },
        onFail: function(error) {
            alert('Failed to preview, error code: ' + error.errorCode);
        }
    });
    

    Method: FSOpen.media.file.preview
    JS Version: 2.0.0
    Client Support: 5.4.0 and above

    Parameters:

    Parameter Type Required Description
    fileNPath String Yes N-Path address of the document, which must be stored on the Fxiaoke platform. Supported file extensions include doc, docx, pdf, ppt, pptx, and other common document formats.

    # Image

    API Name Description
    media.image.preview Preview image

    # Image Preview

    Sample code:

    FSOpen.media.image.preview({
        index: 0,
        imgUrls: [
            'https://www.fxiaoke.com/static/img/index/icon-wx-small.png?v=5.1.5',
            'https://www.fxiaoke.com/static/img/index/icon-kh-small.jpg?v=5.1.5'
        ]
    });
    

    Method: FSOpen.media.image.preview
    JS Version: 2.0.0
    Client Support: 5.4.0 and above

    Parameters:

    Parameter Type Required Description
    index Number No Index of the image to start previewing (0-based). Default is 0.
    imgUrls Array[String] Yes List of image URLs. Default is empty.
    Fxiaoke
    Utilities

    ← Fxiaoke Utilities→

    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式