Change Password

Please enter the password.
Please enter the password. Between 8-64 characters. Not identical to your email address. Contain at least 3 of uppercase, lowercase, numbers, and special characters (such as @*&#).
Please enter the password.
Submit

Change Nickname

Current Nickname:
Submit

v4.2
Search
中文EN
v4.2

    Download | Export

    download()

    Method and interface:

    download(params: RequestType.Download, 
    		 commonReq: RequestType.CommonStreamRequire
    ): Promise<ClientReadableStream<DownloadFileReply>>
    
    interface Download {
        fileName: string;
        taskId: string;
    }
    
    interface CommonStreamRequire extends RequestConfig {
        stream: Stream;
    }
    
    interface Stream {
        onStart?: () => void;
        onClose?: () => void;
        onData: (data: any) => void | Promise<any>;
        onEnd: () => void;
        onError?: (err: Error) => void;
        onPause?: () => void;
        onReadable?: () => void;
        onResume?: () => void;
        package_limit?: number;
    }
    

    Example: Download file 'degree_test' from algorithm task 134 to the current project with filename 'test.csv'. The algorithm task was executed against graphset 'test'

    import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      // omit code of establishing server connection 'conn' using graphset 'default'
      
      var fs = require("fs");
      var path = __dirname + "\\test.csv";
      console.log(path);
      let res = await new Promise(async (resolve, reject) => {
        let v = await conn.download(
          { fileName: "degree_test", taskId: "134" },
          {
            graphSetName: "test",
            stream: {
              onData: (data) => {
                console.log(data.toString().substring(0, 100));
                fs.writeFile(path, data.toString(), function (err: any) {
                  if (err) throw err;
                  console.log('file saved!');
                });
              },
              onEnd: () => {
                resolve("success");
              },
              onError(err) {
                resolve(err);
              }
            }
          }
        )
      });
      
    };
    
    sdkUsage().then(console.log).catch(console.log);
    

    export()

    Method and interface:

    export(params: RequestType.Export, 
    	   commonReq: RequestType.CommonStreamRequire
    ): Promise<ClientReadableStream<ExportReply>>
    
    interface Export {
        dbType: ULTIPA.DBType;
        schema: string;
        limit: number;
        properties: string[];
    }
    interface CommonStreamRequire extends RequestConfig {
        stream: Stream;
    }
    
    interface Stream {
        onStart?: () => void;
        onClose?: () => void;
        onData: (data: any) => void | Promise<any>;
        onEnd: () => void;
        onError?: (err: Error) => void;
        onPause?: () => void;
        onReadable?: () => void;
        onResume?: () => void;
        package_limit?: number;
    }
    

    Example: Export 100 nodes from schema 'default' of graphset 'test', carring properties @default.name and @default.age

    import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      // omit code of establishing server connection 'conn' using graphset 'default'
      
      await conn.export(
        { 
          dbType: ULTIPA.DBType.DBNODE, 
          schema: "default", 
          limit: 100, 
          properties: ["name", "age"] 
        },
        {
          graphSetName: "test",
          stream: {
            onData: (data) => {
              console.log(data);
            },
            onEnd: () => {
              console.log("export finish");
            }
          }
        }
      );  
      
    };
    
    sdkUsage();
    
    Please complete the following information to download this book
    *
    公司名称不能为空
    *
    公司邮箱必须填写
    *
    你的名字必须填写
    *
    你的电话必须填写
    *
    你的电话必须填写