All files / client/methods downloadfile.js

33.33% Statements 1/3
0% Branches 0/1
50% Functions 1/2
33.33% Lines 1/3
1 2 3 4 5 6 7 8 9 10 11 12            12x          
/* @flow */
 
import type { MethodApi, FileLocal } from '../types';
import type { DownloadOptions } from '../../api/types';
 
export default ({ client }: MethodApi) =>
  (fileid: number, filename: string, options: DownloadOptions = {}): Promise<FileLocal> => {
    const { getfilelink, download } = client;
 
    return getfilelink(fileid).then(download(filename, options));
  };